[fpc-pascal] Happy tickets benchmark

Michael Van Canneyt michael at freepascal.org
Sun Feb 14 12:09:42 CET 2016



On Sun, 14 Feb 2016, Florian Klaempfl wrote:

> Am 14.02.2016 um 10:45 schrieb Mattias Gaertner:
>> On Sun, 14 Feb 2016 10:35:22 +0100
>> Florian Klaempfl <florian at freepascal.org> wrote:
>>
>>> [...]
>>> Do you think people will bother? Nobody mentioned to the original poster
>>> so far:
>>> - that the used FPC is outdated
>>> - that only -O2 is used instead of -O3 (or -O4 with 3.0.0)
>>> - that even FPC 2.6.4 has a -Ooloopunroll option which is never enabled
>>> by default and which is worth a try
>>>
>>> I do not know if the points above really effect the example, but it
>>> tells me enough not to bother either :)
>>
>> Maybe documentation helps here.
>
> You mean something like the page Size Matters? See the post of Martin
> Schreiber how much such pages help.
>
>>
>> Is there already a page "pimp my fpc"?
>
> In this case even fpc -h would have helped :)
>
> But actually, before bothering randomly with command line options, I
> would just rewrite the inner loop. Something like
>              for n7 := 0 to 9 do
>                if n1 + n2 + n3 + n4 - n5 - n6 - n7 in [0..9] then
>                  Inc(TicketsCount);
> should be much better.

To back up Florian with numbers:

No in:
Found 4816030 tickets. Elapsed time, msec: 171

Using in:
Found 4816030 tickets. Elapsed time, msec: 23

Michael.



More information about the fpc-pascal mailing list