Don't know if this is the case here, but in general, instruction caches can have rather unpredictable effects on performance. Small changes that should improve performance can result in more instruction cache collisions, and lower performance. Adding extra junk instructions can faster in slower code, and removing some can result in slower code.
You could test this hypothesis by trying your code on a machine with a different processor (one that has a different instruction cache configuration). You might find you get different results.
⁻ Maxime
I modified the implementation of Fibonacci I showed you at last meeting to do the lookup for the function on the global object only the first time the function is called. I patch the relative offset to the function at the call site (no global object) once the function address is known using a technique similar to what Marc described in a previous mail.
Although the output is correct, I can't make sense of the performance results I get. Replacing only one of the two recursive call (either one) by the "optimized" one I get a .4 second speedup but replacing both incurs a slowdown of .1 second! Tests were made on my laptop (Macbook) for fib(40).
The code is in another branch: 'directFuncCall'.
To run it, simply call:
./fib-ir.sh
from the codegen directory.
A direct link to the gitweb source file is:
http://www.iro.umontreal.ca/~tachyon/gitweb/gitweb.cgi?p=tachyon.git;a=blob;... http://www.iro.umontreal.ca/%7Etachyon/gitweb/gitweb.cgi?p=tachyon.git;a=blob;f=source/codegen/test-x86-fibonacci-ir-translation.js;h=6ffacf77eaa04011780031b7ed0477703daa7caa;hb=bcdcae509bf05fac5e7d7ee7b2da214cb7d216ca
Your ideas are welcomed!
Erick
Le 10-08-29 13:57 , Marc Feeley a écrit :
Neat! Can you measure what you would get with a direct branch (no lookup) to see how much was saved by the faster lookup.
Marc
On 2010-08-28, at 12:22 PM, Erick Lavoie wrote:
Experiments after having changed the lookup algorithm on the global object to test for the 3 first properties before doing a linear search show a .5 second speedup on a 2.13 GHz Intel Core 2 Duo Macbook for fib(40).
Fast lookup: user 0m3.702s
Original Linear search: user 0m4.339s
Those tests can be repeated by running:
time make test
in the two following branches, available on the tachyon repository:
globalOriginalLinearSearch globalFastSearch
The source code for the search algorithm can be found in 'codegen/ir-to-asm-x86.js' at line:
338: irToAsm.translator.prototype.get_prop_addr = function (opnds, dest)
Erick
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list
Tachyon-list mailing list Tachyon-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/tachyon-list