unexpected optimazation performance

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

unexpected optimazation performance

Post by srvaldez »

some weeks ago I was tinkering with javascript and someone had written some code to benchmark the performance of BigInt in javascript, among the tests was a tiny program to calculate Pi using the ArcSin series http://ajennings.net/blog/a-million-dig ... cript.html

so I wrote it in FB using my decimal floating-point and my binary floating-point routines, the binary version is usually faster
setting the precision to 20020 digits and compiling with fbc64 -arch native -gen gcc -Wc -O2 the decimal version took almost 8 seconds whereas the binary version took about 26 seconds, that was unexpected so I looked at the code in both versions but could not explain why the binary version was slower than the decimal version, then I compiled with -O3 and the execution time for the binary version went down to about 5.5 seconds, over 5.7 times faster, still no idea why the drastic difference in performance because quite frequently -O3 is a tiny bit slower, rarely faster
Post Reply