[Gambas-user] Problems with interpreter optimization and CPU behaviour

Benoit Minisini benoit.minisini at gambas-basic.org
Sat Oct 8 20:54:41 CEST 2022


Le 08/10/2022 à 20:44, Benoit Minisini a écrit :
> Le 08/10/2022 à 20:15, Jussi Lahtinen a écrit :
>> Could be some limit in the speculative execution. Any correlations to 
>> the L1 - L4 cache sizes of your CPU?
>>
>> Jussi
>>
> 
> My Ryzen 5700G L1 cache size is 64Kb by core, according to this link: 
> https://www.techpowerup.com/cpu-specs/ryzen-7-5700g.c2472
> 
> The object file of the interpreter loop (gbx_exec_loop.c) has less than 
> 32Kb of machine code inside according to 'objdump'.
> 
> I suspected the gcc compiler to do something weird with the '-O3' 
> optimization, i.e. taking some optimization decisions that have huge 
> effects as soon as you add three lines of code...
> 

I'm almost sure it's the gcc compiler...

If I add my new bytecode implentation, execution time is 3,5 s.

If then I add a line to print a debugging message on the error output 
inside the interpreter loop, where that new bytecode is interpreted, the 
execution time goes down to 2,2 s, whereas this bytecode is never used 
in the executed benchmark, and so the code is never executed!

It's bad sorcery!!!

-- 
Benoît Minisini.



More information about the User mailing list