[fpc-pascal] Happy tickets benchmark

leledumbo leledumbo_cool at yahoo.co.id
Sat Feb 13 18:43:34 CET 2016


Here's a test from my machine (Manjaro Linux x86_64 KDE desktop kernel 4.4.1
Core i5-4200u):

$ fpc -CX -XXs -O3 test.pas
Hint: End of reading config file /etc/fpc.cfg
Target OS: Linux for x86-64
Compiling test.pas
Linking test















/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
25 lines compiled, 0.4 sec
1 hint(s) issued
$ time ./test
Found 4816030 tickets. Elapsed time, msec: 225

real	0m0.226s
user	0m0.223s
sys	0m0.000s
$ clang -o test -s -O3 test.c
$ time ./test
Found 4816030 tickets. Time elapsed: 70 msec

real	0m0.071s
user	0m0.070s
sys	0m0.000s
$ gcc -o test -s -O3 test.c
$ time ./test
Found 4816030 tickets. Time elapsed: 109 msec

real	0m0.110s
user	0m0.107s
sys	0m0.000s
$ mcs test.cs -optimize
$ time mono test.exe
Found 4816030 tickets. Time elapsed: 236 msec

real	0m0.267s
user	0m0.260s
sys	0m0.003s

Below is the produced assembly from fpc, gcc and clang (no idea how to get
one for mono):
test.s
<http://free-pascal-general.1045716.n5.nabble.com/file/n5724116/test.s>  
test.s
<http://free-pascal-general.1045716.n5.nabble.com/file/n5724116/test.s>  
test.s
<http://free-pascal-general.1045716.n5.nabble.com/file/n5724116/test.s>  

I hope they can be optimizers' / code generator writers' reference to
improve our compiler.

Anyway, I've tried changing the for loop into while since Pascal's for isn't
a syntactic sugar for while as in C's for, but apparently that didn't change
anything so the emitted code is already as best as it can.



--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Happy-tickets-benchmark-tp5724109p5724116.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.



More information about the fpc-pascal mailing list