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

Jussi Lahtinen jussi.lahtinen at gmail.com
Sat Oct 8 20:15:26 CEST 2022


Could be some limit in the speculative execution. Any correlations to the
L1 - L4 cache sizes of your CPU?

Jussi

On Sat, Oct 8, 2022 at 8:34 PM Benoit Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Hi,
>
> Just an informative mail about the current interpreter optimizations,
> and the problem I encounter.
>
> I have just added a new bytecode for implementing the different memory
> write instructions : 'Byte@(ptr) = value', 'Int@(ptr) = value', and so on.
>
> The interpreter loop is a big switch based on a big jump table (one by
> bytecode, they are 256).
>
> Adding the new bytecode is just adding a new "goto" target destination,
> a call to the function that implements the new instructions, and another
> 'goto' instruction to move to the next bytecode.
>
> Something like that:
>
> _SUBR_POKE:
>
>         SUBR_poke(code); // 'code' is the bytecode being interpreted
>         goto _NEXT;
>
> If I test the 'mandelbrot.gbs' benchmark, its execution time becomes
> 150% slower when I just add these three lines of C code!
>
> I have no idea why. At the moment, I think that the size of the
> interpreter loop pass some sort of cache limit somewhere that trashes
> the CPU performances. But all that seems random to me, and makes
> optimizing vey difficult!
>
> If someone has any idea, he's welcome!
>
> --
> Benoît Minisini.
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221008/201bd764/attachment-0001.htm>


More information about the User mailing list