Skip to content

Instantly share code, notes, and snippets.

@Pavel-Durov
Last active February 3, 2026 21:11
Show Gist options
  • Select an option

  • Save Pavel-Durov/3481ad67f32fc6db91eb749aad1e8317 to your computer and use it in GitHub Desktop.

Select an option

Save Pavel-Durov/3481ad67f32fc6db91eb749aad1e8317 to your computer and use it in GitHub Desktop.
2026-01-03-yklua-profiling

Experiment 09: JIT vs Interpreter Time Analysis

This experiment measures the time spent in JIT-compiled code versus the interpreter.

Methodology

JIT Time         = duration_jit_executing
Interpreter Time = wall_clock - jit_executing - trace_mapping - deopting

Benchmark Results

Benchmark Size Iters JIT (s) JIT % Interp (s) Interp % Total (s)
Bounce 1500 3 2.62 97.37% 0.07 2.52% 2.69
CD 250 3 9.65 97.09% 0.23 2.31% 9.94
DeltaBlue 12000 3 1.76 44.90% 2.03 51.98% 3.91
Havlak 1500 3 20.03 87.51% 2.79 12.18% 22.89
Json 100 3 3.83 95.30% 0.16 4.00% 4.02
List 1500 3 2.46 99.07% 0.02 0.81% 2.48
lulpeg 3 3.61 84.77% 0.52 12.27% 4.26
Mandelbrot 500 3 0.37 96.99% 0.01 2.75% 0.39
NBody 250000 3 1.38 97.41% 0.03 2.45% 1.42
Permute 1000 3 2.51 98.28% 0.04 1.45% 2.55
Queens 1000 3 1.44 98.12% 0.02 1.47% 1.47
Richards 100 3 12.38 99.44% 0.05 0.40% 12.45
Sieve 3000 3 1.10 98.88% 0.01 1.12% 1.12
Storage 1000 3 7.14 99.55% 0.03 0.39% 7.18
Towers 600 3 2.52 95.18% 0.12 4.52% 2.65

Analysis: High Interpreter Time Benchmarks

Three benchmarks spend significant time in the interpreter (>10%)

Benchmark Interp % Traces Compiled Trace Executions Compilation (s)
DeltaBlue 51.98% 132 103,426 4.10
lulpeg 12.27% 818 79,724 13.91
Havlak 12.18% 302 37,006 3.70

Perf Profiles

DeltaBlue (51.98% interpreter)

Top functions by CPU time:

% Function Category
11.96 __yk_opt_luaH_getshortstr Interpreter
9.95 luaV_execute Interpreter
7.15 __memmove_avx512_unaligned Memory (libc)
6.31 Inst::decopy_eq (ykrt) JIT Compiler
3.82 _int_malloc Memory (libc)
2.43 __yk_trace_14 JIT Trace
1.96 Opt::cse (ykrt) JIT Compiler
1.71 luaC_step GC

Highlight: ~22% of time is spent in interpreter functions (luaV_execute, luaH_getshortstr), but deopt time is minimal, only 0.116 seconds.

lulpeg (12.27% interpreter)

Top functions by CPU time:

% Function Category
17.67 Inst::decopy_eq (ykrt) JIT Compiler
8.47 __memmove_avx512_unaligned Memory (libc)
5.23 Opt::cse (ykrt) JIT Compiler
3.06 __yk_trace_90 JIT Trace
2.67 __yk_trace_242 JIT Trace
2.30 moveresults_full Interpreter
2.14 luaV_execute Interpreter
1.75 str_byte Interpreter

Highlight: ~23% of time is spent in JIT compiler functions (decopy_eq, cse).

Havlak (12.18% interpreter)

Top functions by CPU time:

% Function Category
9.43 __yk_opt_luaH_getshortstr Interpreter
6.17 _int_malloc Memory (libc)
6.08 malloc Memory (libc)
4.65 malloc_consolidate Memory (libc)
4.23 __yk_opt_propagatemark GC
4.11 luaC_step GC
3.68 _int_free_chunk Memory (libc)
3.03 Inst::decopy_eq (ykrt) JIT Compiler
2.35 __yk_opt_luaC_step GC

Highlight: ~20% of time is spent in memory allocation (malloc, free) and ~11% in GC (luaC_step, propagatemark).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment