[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gbs3 not exiting
[Thread Prev] | [Thread Next]
- Subject: Re: gbs3 not exiting
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Sat, 14 Nov 2026 16:28:15 -0800
- To: user@xxxxxxxxxxxxxxxxxxxxxx
I have been working on adding support for the libtcc into the jit module of gambas it improves the compile time, quite a lot, but long running compute tasks are a little slower.
I configured it to use libtcc if found else it will fall back to gcc.I can submit a merge request if anyone is interested. , I built libtcc as a relocatable lib, can be loaded at runtime. but the debian libtcc is a static, and must be linked at build time to the gbx3 module..... Also I found a bug in the latest code updates in the JIT_get_code_size() for functions without labels, causes segfault
I also have a patch for that. Here is the comparison gsh (Gambas shell, 3 JIT modules: gb, gb.highlight, westwood.sharedmem) startup time of 'gsh -S -c "echo hi"', median of 7 runs (3 for gcc cold): Mode Startup Range Interpreter (no JIT) 0.057 s 0.053 - 0.067 gcc -O2, cold (no cache) 19.5 s 19.46 - 19.54 gcc -O2, warm cache 0.197 s 0.167 - 0.205 libtcc, cold (no cache) 0.295 s 0.284 - 0.303 libtcc, warm cache 0.102 s 0.102 s libtcc, in memory (GB_JIT_CACHE=0) 0.280 s 0.271 - 0.288 A cold start is ~66x faster with libtcc. Warm, libtcc is ~2x faster thangcc, because the per-process pointer table is rebuilt in-process instead of
forking gcc. Benchmarks (main/benchmark), run time in seconds, output compared with the interpreter's: Benchmark Interp gcc -O2 libtcc gcc output libtcc output mandelbrot 2.05 0.15 0.39 last-digit drift same nbody 3.60 0.40 0.88 last-digit drift same polynom 6.26 0.82 2.14 same same primes 2.33 0.79 1.11 same same sort 2.70 0.40 0.79 same same string1 1.75 1.78 1.55 same same string2 2.13 1.52 2.20 same same btree 3.78 3.67 4.60 same same gcc's last-digit drift comes from -march=native contracting multiply-adds into FMA instructions. libtcc code runs 1.4-2.7x slower than gcc -O2 on compute-bound code, still much faster than the interpreter.libtcc wins on startup and compile time; gcc wins on raw speed of long-running
code. GB_JIT_CC=gcc selects gcc when that matters more. On 11/13/26 12:17, Bruce Steers wrote:
can't it do it in the background as a task?seems the actual highlighters return their values right away, then the process holds while all the jit libs are made, then finally the process ends.so could it just make the libs in a background task?Or maybe make the libs in a more permanent place so it does not have to remake them at each boot? ~/.local/libs/gambas3 or something?I would not exactly call my laptop slow, it's an 8 core i5 dell Latitude, it's not the best but it's not bad. Still that one line of code takes 45 seconds on a fresh JIT cache in /tmp/.Respects. BruceSOn Fri, 13 Nov 2026 at 18:45, Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> wrote:Le 13/11/2026 à 18:55, Brian G a écrit : > I would be good if at the time the software (apps,libs,components) is > installed onto the machine, that a /lib/gambas3/cache be created for > apps and lib/components that use jit, some part of the install process > invokes the jit compiler on the system being installed upon and caches > it in the system folder, where gambas looks first for cached built jit > code... I wonder if that sort of thing is possible. It sure would speed > things up. I can't, and I don't want, because JIT must not break architecture-independant packages, and because JIT does not just depends on the system, but on the CPU too. > > on the up side, if you change the jit compile flags such that they do > not do aggressive in-lining it speeds the time taken up by quite a lot. > Maybe this is a solution for "slow" computers, using "-O2" instead of "-O3". I will check...-- Benoît Minisini.
-- ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
| Re: gbs3 not exiting | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| gbs3 not exiting | Bruce Steers <bsteers4@xxxxxxxxx> |
| Re: gbs3 not exiting | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| Re: gbs3 not exiting | Bruce Steers <bsteers4@xxxxxxxxx> |
| Re: gbs3 not exiting | Brian G <brian@xxxxxxxxxxxxxxxx> |
| Re: gbs3 not exiting | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| Re: gbs3 not exiting | Bruce Steers <bsteers4@xxxxxxxxx> |