[Gambas-user] More speed for you

Benoît Minisini benoit.minisini at gambas-basic.org
Sun Oct 1 19:44:28 CEST 2023


Le 01/10/2023 à 09:37, Laurent Carlier a écrit :
> Le dimanche 1 octobre 2023, 09:24:17 CEST Benoît Minisini a écrit :
>> Hi,
>>
>> Today is the Solemnity of Our Lady of the Rosary, so here is a little
>> gift: a big optimization of the interpreter in the last commit.
>>
>> You can see the result on the wiki in the benchmark page:
>> https://gambaswiki.org/edit/doc/benchmark
>>
>> Now Gambas beats the latest version of Python, Perl and OpenJDK Java in
>> all benchmark but one.
>>
>> If someone could port the benchmarks to Ruby, maybe we would be able to
>> claim Gambas to be the fastest full-featured interpreter on the galaxy? :-)
>>
>> Beware: this is fresh code, so you may encounter crashes. As usual,
>> report any problem.
>>
>> Enjoy!
> 
> Wow ! congrats :)
> 
> How did you succeed on this awesome result ? Maybe some "behind-the-scene"
> details ?
> 

It's actually simple: instead of always using a specific global 
variable, I temporarily transfer it to a local variable in the main 
interpreter loop.

This variable is the "Program Counter", i.e. a pointer that points at 
the next bytecode to execute.

Apparently the 
hyper-vectorizer-loop-enroller-automatic-inlining-store-merging-strict-aliasing 
optimizer needs this help for doing this simple optimization. No idea why.

It's a bit my fault, as I could have done that for a long time. But 
really the difference in performance in programs that run a lot of 
bytecode (loops, computations, manual sort...) is shocking and unexpected.

Maybe I can do the same thing to the "Stack Pointer", and see if I can 
gain some speed again... But it's more complicated.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list