3 ms·
Although I only looked at the code briefly I suspect it will very hard to get good performance from the API as provided[1]. It looks like you have to do a func
by gizmo 2y ago
Although I only looked at the code briefly I suspect it will very hard to get good performance from the API as provided[1].
It looks like you have to do a function call for every high level assembly instruction which in turn does quite a bit of work. See `emit_x86_instruction`[2], most of which is redundant and most of which can be done ahead of time. To JIT quickly you want to work with templates if at all possible. Precompile those templates for the relevant architecture. Then at runtime you just patch the precompiled machine code with the correct addresses and registers. This extra speed really matters because if JITing code is cheap you can compile functions multiple times, inline aggressively and do many other optimizations that wouldn't be economical otherwise.
[1] https://github.com/zherczeg/sljit/blob/master/test_src/sljitTestCall.h https://github.com/zherczeg/sljit/blob/master/test_src/sljit...
[2]: https://github.com/zherczeg/sljit/blob/master/sljit_src/sljitNativeX86_64.c https://github.com/zherczeg/sljit/blob/master/sljit_src/slji...
- jhoechtl 2y ago> Although I only looked at the code briefly I suspect it will very hard to get good performance from the API as provided[1]. Let Common Sense reign. If the target Plattform I remains abstract, it will be a generic machine code translation. No way for sensible performance. I would love to see a Lua transpiler.
- burntsushi 2y ago> I suspect it will very hard to get good performance from the API as provided PCRE2's jit engine, which is powered by sljit, is one of the fastest regex engines in existence (according to my own benchmarks): https://github.com/BurntSushi/rebar?tab=readme-ov-file#summary-of-search-time-benchmarks https://github.com/BurntSushi/rebar?tab=readme-ov-file#summa...
- jonstewart 2y agoZoltan did an amazing job integrating sljit into PCRE. I wonder how many millions of tons of CO2 emissions it’s prevented? Maybe faster jits are possible, but this is one that’s moved the needle.