This patch remove waymarking and replaces it with storing a pointer to the User in the Use.
here are the results on the measurements for the CTMark tests of the test suite.
Metric: instructions_count Program baseline patched diff test-suite :: CTMark/ClamAV/clamscan.test 72557942065 71733653521 -1.1% test-suite :: CTMark/sqlite3/sqlite3.test 76281422939 75484840636 -1.0% test-suite :: CTMark/consumer-typeset/consumer-typeset.test 51364676366 50862185614 -1.0% test-suite :: CTMark/SPASS/SPASS.test 60476106505 59908437767 -0.9% test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 112578442329 111725050856 -0.8% test-suite :: CTMark/mafft/pairlocalalign.test 50846133013 50473644539 -0.7% test-suite :: CTMark/kimwitu++/kc.test 54692641250 54349070299 -0.6% test-suite :: CTMark/7zip/7zip-benchmark.test 182216614747 181216091230 -0.5% test-suite :: CTMark/Bullet/bullet.test 123459210616 122905866767 -0.4% Geomean difference -0.8% Metric: peak_memory_use Program baseline patched diff test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 326864 338524 3.6% test-suite :: CTMark/sqlite3/sqlite3.test 216412 221240 2.2% test-suite :: CTMark/7zip/7zip-benchmark.test 11808284 12022604 1.8% test-suite :: CTMark/Bullet/bullet.test 6831752 6945988 1.7% test-suite :: CTMark/SPASS/SPASS.test 2682552 2721820 1.5% test-suite :: CTMark/ClamAV/clamscan.test 5037256 5107936 1.4% test-suite :: CTMark/consumer-typeset/consumer-typeset.test 2752728 2790768 1.4% test-suite :: CTMark/mafft/pairlocalalign.test 1517676 1537244 1.3% test-suite :: CTMark/kimwitu++/kc.test 1090748 1103448 1.2% Geomean difference 1.8% Metric: compile_time Program baseline patched diff test-suite :: CTMark/consumer-typeset/consumer-typeset.test 14.71 14.38 -2.2% test-suite :: CTMark/sqlite3/sqlite3.test 23.18 22.73 -2.0% test-suite :: CTMark/7zip/7zip-benchmark.test 57.96 56.99 -1.7% test-suite :: CTMark/ClamAV/clamscan.test 20.75 20.49 -1.2% test-suite :: CTMark/kimwitu++/kc.test 18.35 18.15 -1.1% test-suite :: CTMark/SPASS/SPASS.test 18.72 18.57 -0.8% test-suite :: CTMark/mafft/pairlocalalign.test 14.09 14.00 -0.6% test-suite :: CTMark/Bullet/bullet.test 37.38 37.19 -0.5% test-suite :: CTMark/tramp3d-v4/tramp3d-v4.test 33.81 33.76 -0.2% Geomean difference -1.1%
i believe that it is worth trading +1.8% peak memory use for -1.1% compile time.
also this patch removes waymarking which simplifies the Use and User classes.
Maybe name the argument Parent instead of U? Does it actually need a default of nullptr?