Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-02

Re: Happy tickets benchmark

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Serguei TARASSOV
Show quoted text 22 lines
Date: Sun, 14 Feb 2016 12:09:42 +0100 (CET) From: Michael Van Canneyt To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] Happy tickets benchmark On Sun, 14 Feb 2016, Florian Klaempfl wrote: > > >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.

As I said, the goal of the test is to compare the compilers, not the programmer's intelligence.
You should remove inner loop from C and C# code to get a meaningful result.

Regards,
Serguei

Reply by email

Florian Klämpfl
to Serguei TARASSOV
Serguei TARASSOV wrote 23 lines
On 14/02/2016 12:57, wrote: > Date: Sun, 14 Feb 2016 12:09:42 +0100 (CET) From: Michael Van Canneyt To: > FPC-Pascal users discussions Subject: Re: [fpc-pascal] Happy > tickets benchmark On Sun, 14 Feb 2016, Florian Klaempfl wrote: >> >> >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. As I said, the goal of the test is to compare the compilers,

The goal, yes.

not the programmer's intelligence. You should remove inner loop from C and C# code to get a meaningful result.

Reply by email

Martin
to Florian Klämpfl
Florian Klämpfl wrote 20 lines
Am 14.02.2016 um 13:34 schrieb Serguei TARASSOV: > On 14/02/2016 12:57, wrote: >>>> 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 > As I said, the goal of the test is to compare the compilers, The goal, yes.

Out of interest, how does the modified code compare with/without the "loop invariant" patch?

Reply by email