tp/docs/BENCHMARKS.md
Kinneyzhang 972b6d4e4c Complete text-property facade and managed lifecycle
Add canonical query semantics, managed metadata and transactions, overlay-aware lookup, reproducible benchmarks, and synchronized API documentation.
2026-07-28 22:42:55 +08:00

2.3 KiB

Reproducible benchmark evidence

Command and environment

make benchmark \
  EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs \
  LOAD_EXTRA='-L /tmp/tp-elpa.Ur243x/dash-2.20.0'
  • Emacs: 30.2
  • Fixed seeds: 1, 7, 42, 747555
  • Reproducible generated seed: 8675309
  • Every scenario performs a correctness assertion before accepting timing.
  • The full command completed successfully on 2026-07-28.

The runner is tp-benchmark.el; make benchmark is the stable entry point. Output rows include scenario, status, fixture, seed, requested/actual size, operations, scanned/changed/refreshed counts, elapsed wall time, and GC count.

Representative result: seed 42

Scenario Requested / actual Operations Scanned Changed Refreshed Elapsed (s) GC
large text 100,000 2 100,000 100,000 0 0.000304 0
large text 1,000,000 2 1,000,000 1,000,000 0 0.000323 0
fragmented intervals 1,000 1 1,000 500 0 0.044254 0
fragmented intervals 10,000 1 10,000 5,000 0 0.404836 1
fragmented intervals 50,000 1 50,000 25,000 0 1.965066 3
stack depth 1 2 2,000 2,000 0 0.000909 0
stack depth 5 6 2,000 2,000 0 0.003204 0
stack depth 20 21 2,000 2,000 0 0.012905 0
stack depth 50 51 2,000 2,000 0 0.037830 0
reactive fan-out 1 / 1 1 1 1 1 0.000763 0
reactive fan-out 10 / 10 1 10 10 10 0.005469 0
reactive fan-out 100 / 100 1 100 100 100 0.051376 0
reactive fan-out 500 / 200 1 200 200 200 0.102989 0
theme refresh 1 / 1 1 1,000 0 1 0.001317 0

The 500-buffer fan-out fixture is intentionally capped at 200 live buffers on local hardware; output reports both requested and actual counts. Theme refresh uses the v1 conservative managed-range strategy.

Interpretation

These figures are advisory, not release thresholds. Fragmented interval count is the clearest scaling risk and should remain the first optimization target. Large-text lookup over one property run and deep-stack top lookup are cheap in this fixture, but those results must not be generalized to fragmented text or repeated stack mutation.