Skip to content

Instantly share code, notes, and snippets.

@nascheme
Last active April 13, 2026 21:59
Show Gist options
  • Select an option

  • Save nascheme/73ecff83a0dbdf18ee85eec41fe3952d to your computer and use it in GitHub Desktop.

Select an option

Save nascheme/73ecff83a0dbdf18ee85eec41fe3952d to your computer and use it in GitHub Desktop.
Tested with https://github.com/nascheme/cpython/tree/gc-gen-3.14 (b4ea6d82324cf84f74731a88decd7577eccde2f9)
Benchmark script: https://gist.github.com/nascheme/6d09885d3696055b9665d3b88c7aacaa
inc_gc OFF (0) vs ON (1) comparison
cycle extra live t0(s) t1(s) Δt% rss0 rss1 Δrss% trash0 trash1
--------------------------------------------------------------------------------------------------
10 0 100 0.66 0.73 +10.0 16M 17M +6 6k 28k
10 0 1.0k 0.66 0.76 +14.2 17M 20M +19 14k 82k
10 0 10.0k 0.78 0.84 +7.8 20M 26M +29 88k 224k
10 1.0k 100 0.73 0.76 +4.9 16M 20M +21 6k 28k
10 1.0k 1.0k 0.73 0.81 +10.1 18M 28M +56 14k 82k
10 1.0k 10.0k 0.85 0.91 +7.1 28M 49M +74 88k 224k
10 10.0k 100 0.76 0.89 +17.4 19M 44M +127 6k 28k
10 10.0k 1.0k 0.86 0.99 +14.4 29M 98M +238 14k 82k
10 10.0k 10.0k 1.14 1.26 +10.6 103M 241M +134 88k 224k
10 100.0k 100 1.83 2.97 +62.2 58M 281M +386 6k 28k
10 100.0k 1.0k 2.70 2.97 +9.8 127M 793M +527 14k 82k
10 100.0k 10.0k 3.96 4.18 +5.6 847M 2.1G +155 88k 224k
100 0 100 0.50 0.54 +8.9 16M 17M +6 6k 28k
100 0 1.0k 0.53 0.56 +5.9 17M 20M +18 15k 81k
100 0 10.0k 0.62 0.63 +2.2 20M 26M +29 88k 224k
100 1.0k 100 0.52 0.56 +7.0 16M 17M +6 6k 28k
100 1.0k 1.0k 0.54 0.56 +3.3 17M 20M +22 15k 81k
100 1.0k 10.0k 0.61 0.65 +6.1 21M 28M +35 88k 224k
100 10.0k 100 0.53 0.59 +10.5 17M 19M +12 6k 28k
100 10.0k 1.0k 0.54 0.60 +10.6 18M 27M +52 15k 81k
100 10.0k 10.0k 0.65 0.70 +7.3 27M 48M +74 88k 224k
100 100.0k 100 1.15 1.07 -6.7 19M 36M +91 6k 28k
100 100.0k 1.0k 0.66 0.76 +14.0 29M 96M +232 15k 81k
100 100.0k 10.0k 0.86 0.98 +13.4 98M 240M +144 88k 224k
1.0k 0 100 0.52 0.52 +1.2 18M 21M +22 23k 110k
1.0k 0 1.0k 0.52 0.53 +2.6 18M 21M +22 23k 110k
1.0k 0 10.0k 0.58 0.60 +4.6 21M 27M +30 93k 227k
1.0k 1.0k 100 0.53 0.52 -1.3 18M 21M +22 23k 110k
1.0k 1.0k 1.0k 0.56 0.55 -2.9 18M 21M +22 23k 110k
1.0k 1.0k 10.0k 0.59 0.60 +1.6 21M 27M +31 93k 227k
1.0k 10.0k 100 0.53 0.54 +2.1 18M 22M +27 23k 110k
1.0k 10.0k 1.0k 0.52 0.53 +1.7 18M 22M +27 23k 110k
1.0k 10.0k 10.0k 0.58 0.60 +3.4 21M 29M +35 93k 227k
1.0k 100.0k 100 0.57 0.55 -2.7 19M 31M +62 23k 110k
1.0k 100.0k 1.0k 0.57 0.56 -2.1 19M 31M +62 23k 110k
1.0k 100.0k 10.0k 0.60 0.64 +6.6 29M 48M +66 93k 227k
Legend
------
Comparison table (inc_gc OFF vs ON, same cycle/extra/live):
cycle objects per reference cycle (--cycle-size)
extra extra bytes payload per cycle (--extra-bytes)
live live-object target before holder is cleared (--live-objects)
t0 / t1 total time(s) with inc_gc=0 / inc_gc=1
Δt% percent change in time, (t1 - t0) / t0 * 100
rss0/rss1 peak RSS with inc_gc=0 / inc_gc=1
Δrss% percent change in peak RSS, (rss1 - rss0) / rss0 * 100
trash0/1 max uncollected cyclic-garbage with inc_gc=0 / inc_gc=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment