Skip to content

Convert spike PDFs to Markdown, update VM docs, add optimization log - #105

Merged
frostney merged 5 commits into
mainfrom
docs/update-vm-bytecode-docs
Mar 18, 2026
Merged

frostney merged 5 commits into
mainfrom
docs/update-vm-bytecode-docs

Conversation

@frostney

@frostney frostney commented Mar 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Convert all 4 PDF spike documents to Markdown (fpc-string-performance, fpc-hashmap-performance, fpc-generics-performance, fpc-dispatch-performance) for better AI agent parsing and accessibility
  • Fix stale TSouffleValue documentation across souffle-vm.md and design-decisions.md: 26 bytes → 16 bytes, string[23] → string[13] (reflecting PR Experiment: SOUFFLE_INLINE_STRING_MAX = 13 #96)
  • Align test count to 3,501 across all docs (AGENTS.md, README.md, souffle-vm.md, design-decisions.md)
  • Add svkString to TSouffleValue kinds list and THashMap optimization details in AGENTS.md
  • Add docs/optimization-log.md — a comprehensive record of all VM optimization experiments, what worked, what didn't, remaining work, and key insights for future contributors
  • Add "Update (March 2026)" note to hashmap spike documenting TScopeMap removal and THashMap/TOrderedStringMap optimizations

Test plan

  • All markdown links resolve correctly
  • No remaining .pdf references in any .md files
  • No stale 26-byte / string[23] / 3,406 test count references remain
  • Documentation index in AGENTS.md includes new optimization-log.md

Made with Cursor

Summary by CodeRabbit

  • New Features

    • Added bytecode (.sbc) serialization support (format version 3).
    • Value system now includes a string variant; inline short-string capacity reduced to 13 chars.
  • Performance

    • Optimizations improving lookup and call-dispatch performance.
  • Documentation

    • Test suite metrics updated to 3,501 tests.
    • Added decision log, optimization log, and multiple performance spike reports (dispatch, generics, hash maps, strings).
  • New Skill

    • Added a "grill-me" interview-style skill.

- Convert all 4 PDF spike documents (string performance, hashmap
  performance, generics performance, dispatch performance) to Markdown
  for better AI agent parsing
- Fix stale TSouffleValue documentation: 26 bytes → 16 bytes,
  string[23] → string[13] across souffle-vm.md, design-decisions.md
- Update test count to 3,501 across all docs (AGENTS.md, README.md,
  souffle-vm.md, design-decisions.md)
- Add svkString to TSouffleValue kinds list in AGENTS.md
- Add THashMap optimization details to AGENTS.md component table
- Add docs/optimization-log.md with full VM optimization history,
  experiment results, remaining work, and key insights for fresh
  context pickup
- Add hashmap spike update note documenting TScopeMap removal,
  TOrderedStringMap refactoring, and THashMap hash optimization

Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4209f59a-f402-4f25-b1b0-432f01b36d4e

📥 Commits

Reviewing files that changed from the base of the PR and between 09bca7e and bc1e9ff.

📒 Files selected for processing (2)
  • .agents/skills/grill-me/SKILL.md
  • skills-lock.json
✅ Files skipped from review due to trivial changes (1)
  • .agents/skills/grill-me/SKILL.md

📝 Walkthrough

Walkthrough

Adds documentation spikes and logs; reduces TSouffleValue size (26 → 16 bytes) with inline-string limit (23 → 13 chars); extends TSouffleValue with a String variant; documents THashMap pointer-sized multiplicative hashing and bitwise‑AND indexing; introduces Souffle.Bytecode.Binary.pas for .sbc serialization (SOUFFLE_FORMAT_VERSION = 3); updates test counts (3,406 → 3,501).

Changes

Cohort / File(s) Summary
Core VM types & bytecode
Souffle.Value.pas, Souffle.Bytecode.Binary.pas
TSouffleValue gains a String variant; packed value layout changed to 16 bytes with 13‑char inline strings. New public unit Souffle.Bytecode.Binary.pas added for .sbc serialization (SOUFFLE_FORMAT_VERSION = 3).
Hash map docs / implementation notes
docs/spikes/fpc-hashmap-performance.md, docs/code-style.md
Documentation updated/added describing THashMap pointer-sized multiplicative (golden‑ratio/Fibonacci) hashing, direct integer equality, and bitwise‑AND slot indexing; links updated (PDF → MD) and new cross‑references added.
VM & design documentation
AGENTS.md, README.md, docs/design-decisions.md, docs/souffle-vm.md
Text updates reflecting value footprint changes (26→16 B), inline-string threshold (23→13), decorator compilation opcode changes, and test count bump to 3,501.
New optimization & spike docs
docs/optimization-log.md, docs/decision-log.md, docs/spikes/*
Adds docs/optimization-log.md, docs/decision-log.md and multiple spike reports (docs/spikes/fpc-dispatch-performance.md, .../fpc-generics-performance.md, .../fpc-string-performance.md, etc.) documenting benchmarks, experiments, regressions, and decisions.
Minor docs edits & metadata
README.md, docs/code-style.md, .agents/skills/grill-me/SKILL.md, skills-lock.json
Small textual corrections (test counts, links), adds new skill doc grill-me and updates skills-lock.json entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐇 I nibble bytes and trim the heap,

Strings tucked small for faster leap.
Bytecode packets, version three,
Docs and spikes for all to see.
Hop, hop — the VM hums light and free.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the three main changes: converting spike PDFs to Markdown, updating VM documentation, and adding an optimization log.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/update-vm-bytecode-docs
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
docs/spikes/fpc-hashmap-performance.md (1)

9-9: Use one spelling variant for “optimized/optimised” in this document.

The text mixes UK and US variants; pick one for consistency within this file.

Also applies to: 420-420

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/spikes/fpc-hashmap-performance.md` at line 9, The document mixes the US
and UK spellings "optimized" and "optimised"; choose one variant (e.g.,
"optimized") and replace all occurrences consistently throughout the file,
including the instance in the paragraph describing the benchmarked hash maps and
the occurrence around line 420. Search for both "optimized" and "optimised" and
perform a global replace to the chosen spelling, then run a quick pass to ensure
surrounding grammar still reads correctly and update any headings or captions
that used the other variant.
docs/spikes/fpc-string-performance.md (1)

44-44: Tiny style polish for readability.

Consider “44-second pathology” and rephrasing “…remains ~2x faster even then…” for smoother flow.

Also applies to: 145-145

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/spikes/fpc-string-performance.md` at line 44, Change the phrasing for
readability: replace "44 second pathology" with "44-second pathology" and reword
instances of "...remains ~2x faster even then..." (found near
TStringBuilder/TUnicodeStringBuilder/FData and TAnsiStringBuilder mentions) to a
smoother phrase such as "...remains ~2× faster even so..." or "...remains
approximately 2× faster even then..." for consistent, polished style; update
both occurrences referenced (lines around the
TStringBuilder/TUnicodeStringBuilder/FData sentence and the TAnsiStringBuilder
sentence).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/optimization-log.md`:
- Line 208: Remove or modify the map-unit renaming recommendation in the docs so
it no longer suggests renaming shared utility units (BaseMap.pas,
OrderedMap.pas, HashMap.pas, OrderedStringMap.pas) to Goccia.*; instead state
that shared/utility units are intentionally unprefixed and that any naming
follow-up is tracked in issue `#104`, aligning the guidance with the repository
convention.

In `@docs/souffle-vm.md`:
- Around line 367-371: The text incorrectly says "13 characters" for
TSouffleInlineString; change the wording to "13 bytes" and clarify that
TSouffleInlineString = string[13] is byte-counted in this FPC mode (AnsiString),
so Length() is in bytes and UTF‑8 multi‑byte characters may exceed the inline
limit; update the description of svkString, svkReference, and the
SouffleString(AValue) constructor bullets to use "bytes" (Length(AValue) <= 13
bytes → svkString with AsInlineString; > 13 bytes → svkReference to a new
TSouffleHeapString) and add a short note about UTF‑8 characters potentially
requiring more than one byte.

In `@docs/spikes/fpc-generics-performance.md`:
- Around line 25-32: The Local Variables table has incorrect ratio values:
recompute each Ratio as median / baseline (baseline is TGenericStack<Integer>
142.0 ms) and replace the wrong entries (e.g., THandRolledStack and
TDoubleInheritedStack). Specifically, update TSpecialisedStack (140.0 -> x0.99),
TInheritedStack (149.0 -> x1.05), THandRolledStack (222.0 -> x1.56), and
TDoubleInheritedStack (264.0 -> x1.86) in the table row entries so the Ratio
column reflects median/baseline formatted consistently (e.g., x1.56).
- Around line 35-42: The table's Ratio column is incorrect for rows
THandRolledStack and TDoubleInheritedStack; using the baseline median 127.0 ms
recompute ratio = median / 127.0 and update those cells: set THandRolledStack
ratio to x1.72 (219.0/127.0 ≈ 1.72) and TDoubleInheritedStack ratio to x1.96
(249.0/127.0 ≈ 1.96); verify other ratios (TSpecialisedStack and
TInheritedStack) remain x0.98 and x0.99 respectively and keep Verdict text
unchanged unless you want to adjust it after correcting the ratios.

In `@docs/spikes/fpc-hashmap-performance.md`:
- Around line 22-23: The doc still recommends the deleted TScopeMap; update the
spike to remove or mark as historical any recommendations that TScopeMap be used
(sections around the listed ranges) and replace guidance to reflect the current
implementation: note that units/ScopeMap.pas was deleted and scope bindings now
use TOrderedStringMap<TLexicalBinding> with recursive TGocciaScope walking, and
where the text compares performance (e.g., “TScopeMap linear scan + parent chain
walk”) either delete that line or annotate it as historical/removed and add the
correct description of current behavior using TOrderedStringMap and TGocciaScope
traversal.

---

Nitpick comments:
In `@docs/spikes/fpc-hashmap-performance.md`:
- Line 9: The document mixes the US and UK spellings "optimized" and
"optimised"; choose one variant (e.g., "optimized") and replace all occurrences
consistently throughout the file, including the instance in the paragraph
describing the benchmarked hash maps and the occurrence around line 420. Search
for both "optimized" and "optimised" and perform a global replace to the chosen
spelling, then run a quick pass to ensure surrounding grammar still reads
correctly and update any headings or captions that used the other variant.

In `@docs/spikes/fpc-string-performance.md`:
- Line 44: Change the phrasing for readability: replace "44 second pathology"
with "44-second pathology" and reword instances of "...remains ~2x faster even
then..." (found near TStringBuilder/TUnicodeStringBuilder/FData and
TAnsiStringBuilder mentions) to a smoother phrase such as "...remains ~2× faster
even so..." or "...remains approximately 2× faster even then..." for consistent,
polished style; update both occurrences referenced (lines around the
TStringBuilder/TUnicodeStringBuilder/FData sentence and the TAnsiStringBuilder
sentence).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 055af991-61a0-412c-beaa-6a4e3db28b51

📥 Commits

Reviewing files that changed from the base of the PR and between 8266490 and 27ab88b.

⛔ Files ignored due to path filters (4)
  • docs/spikes/fpc-dispatch-performance.pdf is excluded by !**/*.pdf
  • docs/spikes/fpc-generics-performance.pdf is excluded by !**/*.pdf
  • docs/spikes/fpc-hashmap-performance.pdf is excluded by !**/*.pdf
  • docs/spikes/fpc-string-performance.pdf is excluded by !**/*.pdf
📒 Files selected for processing (10)
  • AGENTS.md
  • README.md
  • docs/code-style.md
  • docs/design-decisions.md
  • docs/optimization-log.md
  • docs/souffle-vm.md
  • docs/spikes/fpc-dispatch-performance.md
  • docs/spikes/fpc-generics-performance.md
  • docs/spikes/fpc-hashmap-performance.md
  • docs/spikes/fpc-string-performance.md

Comment thread docs/optimization-log.md Resolved
Comment thread docs/souffle-vm.md Resolved
Comment thread docs/spikes/fpc-generics-performance.md Resolved
Comment thread docs/spikes/fpc-generics-performance.md Resolved
Comment thread docs/spikes/fpc-hashmap-performance.md Resolved
@github-actions

github-actions Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results

254 benchmarks

Interpreted: 🟢 188 improved · 🔴 1 regressed · 65 unchanged · avg +10.4%
Bytecode: 🟢 3 improved · 🔴 12 regressed · 239 unchanged · avg -1.1%

arraybuffer.js — Interp: 🟢 12, 2 unch. · avg +16.4% · Bytecode: 14 unch. · avg -1.3%
Benchmark Interpreted Δ Bytecode Δ
create ArrayBuffer(0) 445,703 → 516,696 🟢 +15.9% 167,036 → 164,467 -1.5%
create ArrayBuffer(64) 437,528 → 502,284 🟢 +14.8% 165,105 → 162,728 -1.4%
create ArrayBuffer(1024) 325,390 → 403,415 🟢 +24.0% 146,120 → 144,922 -0.8%
create ArrayBuffer(8192) 141,168 → 179,040 🟢 +26.8% 84,732 → 87,167 +2.9%
slice full buffer (64 bytes) 501,725 → 592,147 🟢 +18.0% 413,845 → 403,836 -2.4%
slice half buffer (512 of 1024 bytes) 423,551 → 516,218 🟢 +21.9% 357,458 → 351,575 -1.6%
slice with negative indices 422,018 → 527,431 🟢 +25.0% 388,629 → 379,264 -2.4%
slice empty range 485,569 → 583,790 🟢 +20.2% 399,356 → 396,185 -0.8%
byteLength access 1,598,606 → 1,669,526 +4.4% 1,257,053 → 1,253,714 -0.3%
Symbol.toStringTag access 1,177,178 → 1,136,097 -3.5% 696,352 → 699,860 +0.5%
ArrayBuffer.isView 787,572 → 855,855 🟢 +8.7% 586,053 → 576,088 -1.7%
clone ArrayBuffer(64) 424,233 → 485,382 🟢 +14.4% 402,999 → 389,781 -3.3%
clone ArrayBuffer(1024) 320,035 → 386,326 🟢 +20.7% 300,536 → 286,809 -4.6%
clone ArrayBuffer inside object 265,120 → 311,636 🟢 +17.5% 199,505 → 197,567 -1.0%
arrays.js — Interp: 🟢 17, 2 unch. · avg +12.7% · Bytecode: 19 unch. · avg +0.3%
Benchmark Interpreted Δ Bytecode Δ
Array.from length 100 13,609 → 15,208 🟢 +11.7% 15,064 → 14,878 -1.2%
Array.from 10 elements 229,686 → 264,541 🟢 +15.2% 186,517 → 184,274 -1.2%
Array.of 10 elements 317,329 → 367,630 🟢 +15.9% 256,754 → 248,864 -3.1%
spread into new array 326,323 → 371,329 🟢 +13.8% 859,193 → 862,654 +0.4%
map over 50 elements 27,087 → 30,772 🟢 +13.6% 24,792 → 25,369 +2.3%
filter over 50 elements 23,308 → 25,746 🟢 +10.5% 24,174 → 25,188 +4.2%
reduce sum 50 elements 26,719 → 28,871 🟢 +8.1% 22,237 → 21,475 -3.4%
forEach over 50 elements 22,945 → 24,437 +6.5% 27,248 → 27,497 +0.9%
find in 50 elements 34,820 → 38,599 🟢 +10.9% 32,076 → 32,288 +0.7%
sort 20 elements 12,243 → 13,054 +6.6% 12,921 → 12,908 -0.1%
flat nested array 113,270 → 128,859 🟢 +13.8% 476,188 → 480,855 +1.0%
flatMap 71,859 → 83,880 🟢 +16.7% 320,414 → 327,004 +2.1%
map inside map (5x5) 20,953 → 24,323 🟢 +16.1% 108,461 → 107,579 -0.8%
filter inside map (5x10) 15,289 → 18,002 🟢 +17.7% 15,111 → 15,066 -0.3%
reduce inside map (5x10) 19,247 → 21,406 🟢 +11.2% 15,305 → 15,659 +2.3%
forEach inside forEach (5x10) 16,607 → 17,971 🟢 +8.2% 17,311 → 17,619 +1.8%
find inside some (10x10) 13,837 → 15,592 🟢 +12.7% 12,313 → 12,394 +0.7%
map+filter chain nested (5x20) 5,263 → 6,062 🟢 +15.2% 5,089 → 5,106 +0.3%
reduce flatten (10x5) 37,797 → 44,337 🟢 +17.3% 6,797 → 6,702 -1.4%
async-await.js — Interp: 🟢 6 · avg +15.5% · Bytecode: 6 unch. · avg -1.1%
Benchmark Interpreted Δ Bytecode Δ
single await 359,334 → 421,107 🟢 +17.2% 310,703 → 305,741 -1.6%
multiple awaits 159,802 → 188,930 🟢 +18.2% 130,135 → 130,441 +0.2%
await non-Promise value 824,237 → 949,228 🟢 +15.2% 1,038,748 → 1,010,548 -2.7%
await with try/catch 352,243 → 409,344 🟢 +16.2% 301,339 → 295,693 -1.9%
await Promise.all 48,513 → 55,579 🟢 +14.6% 46,972 → 46,637 -0.7%
nested async function call 186,993 → 209,136 🟢 +11.8% 228,902 → 228,738 -0.1%
classes.js — Interp: 🟢 31 · avg +17.6% · Bytecode: 🟢 1, 30 unch. · avg -0.2%
Benchmark Interpreted Δ Bytecode Δ
simple class new 135,107 → 153,790 🟢 +13.8% 404,159 → 400,254 -1.0%
class with defaults 104,083 → 120,981 🟢 +16.2% 282,395 → 283,763 +0.5%
50 instances via Array.from 5,408 → 6,231 🟢 +15.2% 7,597 → 7,376 -2.9%
instance method call 64,893 → 75,607 🟢 +16.5% 186,271 → 181,775 -2.4%
static method call 109,119 → 126,862 🟢 +16.3% 391,695 → 401,483 +2.5%
single-level inheritance 53,127 → 61,771 🟢 +16.3% 174,617 → 171,789 -1.6%
two-level inheritance 45,636 → 53,262 🟢 +16.7% 143,502 → 140,797 -1.9%
private field access 69,360 → 81,716 🟢 +17.8% 196,329 → 194,137 -1.1%
private methods 76,255 → 88,918 🟢 +16.6% 249,644 → 241,991 -3.1%
getter/setter access 73,596 → 85,467 🟢 +16.1% 188,394 → 186,644 -0.9%
class decorator (identity) 87,552 → 104,509 🟢 +19.4% 62,493 → 61,973 -0.8%
class decorator (wrapping) 52,121 → 61,201 🟢 +17.4% 40,211 → 43,654 🟢 +8.6%
identity method decorator 61,010 → 73,429 🟢 +20.4% 49,068 → 45,816 -6.6%
wrapping method decorator 49,498 → 59,542 🟢 +20.3% 45,069 → 44,967 -0.2%
stacked method decorators (x3) 33,028 → 39,500 🟢 +19.6% 30,127 → 30,094 -0.1%
identity field decorator 67,519 → 79,318 🟢 +17.5% 51,547 → 51,439 -0.2%
field initializer decorator 56,801 → 66,998 🟢 +18.0% 45,310 → 45,857 +1.2%
getter decorator (identity) 61,779 → 73,852 🟢 +19.5% 46,378 → 46,605 +0.5%
setter decorator (identity) 52,610 → 62,502 🟢 +18.8% 40,328 → 40,104 -0.6%
static method decorator 65,893 → 79,466 🟢 +20.6% 71,579 → 72,862 +1.8%
static field decorator 77,529 → 91,369 🟢 +17.9% 74,626 → 75,879 +1.7%
private method decorator 50,318 → 60,372 🟢 +20.0% 42,274 → 42,506 +0.5%
private field decorator 54,965 → 66,614 🟢 +21.2% 43,207 → 43,604 +0.9%
plain auto-accessor (no decorator) 99,479 → 113,672 🟢 +14.3% 62,094 → 62,073 -0.0%
auto-accessor with decorator 51,096 → 62,422 🟢 +22.2% 40,979 → 41,127 +0.4%
decorator writing metadata 41,806 → 49,341 🟢 +18.0% 45,772 → 46,283 +1.1%
static getter read 121,194 → 140,817 🟢 +16.2% 426,914 → 420,669 -1.5%
static getter/setter pair 96,347 → 109,508 🟢 +13.7% 232,185 → 229,215 -1.3%
inherited static getter 70,825 → 85,630 🟢 +20.9% 290,189 → 289,827 -0.1%
inherited static setter 80,588 → 91,930 🟢 +14.1% 228,080 → 229,369 +0.6%
inherited static getter with this binding 68,961 → 78,517 🟢 +13.9% 176,409 → 174,812 -0.9%
closures.js — Interp: 🟢 11 · avg +11.8% · Bytecode: 11 unch. · avg -0.4%
Benchmark Interpreted Δ Bytecode Δ
closure over single variable 129,313 → 139,052 🟢 +7.5% 769,812 → 794,267 +3.2%
closure over multiple variables 116,131 → 127,939 🟢 +10.2% 484,266 → 485,259 +0.2%
nested closures 121,390 → 137,472 🟢 +13.2% 711,861 → 692,998 -2.6%
function as argument 92,588 → 103,025 🟢 +11.3% 709,678 → 718,404 +1.2%
function returning function 115,231 → 129,988 🟢 +12.8% 776,958 → 759,926 -2.2%
compose two functions 68,681 → 76,244 🟢 +11.0% 478,101 → 464,498 -2.8%
fn.call 142,163 → 160,117 🟢 +12.6% 149,370 → 145,361 -2.7%
fn.apply 106,605 → 123,087 🟢 +15.5% 100,388 → 101,616 +1.2%
fn.bind 130,298 → 149,291 🟢 +14.6% 150,155 → 149,700 -0.3%
recursive sum to 50 11,266 → 12,352 🟢 +9.6% 52,288 → 52,355 +0.1%
recursive tree traversal 19,143 → 21,324 🟢 +11.4% 76,936 → 77,399 +0.6%
collections.js — Interp: 🟢 5, 7 unch. · avg +7.3% · Bytecode: 12 unch. · avg +0.4%
Benchmark Interpreted Δ Bytecode Δ
add 50 elements 7,143 → 7,756 🟢 +8.6% 6,074 → 5,998 -1.3%
has lookup (50 elements) 89,777 → 96,655 🟢 +7.7% 90,253 → 90,556 +0.3%
delete elements 47,980 → 50,983 +6.3% 38,510 → 38,334 -0.5%
forEach iteration 15,823 → 16,437 +3.9% 18,047 → 17,624 -2.3%
spread to array 27,182 → 30,787 🟢 +13.3% 154,883 → 154,676 -0.1%
deduplicate array 38,276 → 42,370 🟢 +10.7% 51,228 → 51,441 +0.4%
set 50 entries 5,288 → 5,384 +1.8% 6,199 → 6,229 +0.5%
get lookup (50 entries) 86,519 → 88,462 +2.2% 97,278 → 98,766 +1.5%
has check 129,592 → 134,253 +3.6% 156,583 → 156,737 +0.1%
delete entries 45,176 → 46,688 +3.3% 36,703 → 36,628 -0.2%
forEach iteration 15,320 → 16,375 +6.9% 18,014 → 18,098 +0.5%
keys/values/entries 7,161 → 8,539 🟢 +19.2% 21,775 → 22,962 +5.5%
destructuring.js — Interp: 🟢 21, 1 unch. · avg +11.4% · Bytecode: 22 unch. · avg -0.2%
Benchmark Interpreted Δ Bytecode Δ
simple array destructuring 404,453 → 436,834 🟢 +8.0% 1,030,653 → 1,027,885 -0.3%
with rest element 268,127 → 293,945 🟢 +9.6% 762,918 → 758,922 -0.5%
with defaults 415,188 → 448,156 🟢 +7.9% 1,001,772 → 995,109 -0.7%
skip elements 426,283 → 458,275 🟢 +7.5% 1,128,587 → 1,194,594 +5.8%
nested array destructuring 174,126 → 182,929 +5.1% 532,463 → 523,412 -1.7%
swap variables 509,142 → 546,931 🟢 +7.4% 1,447,456 → 1,451,155 +0.3%
simple object destructuring 309,381 → 336,411 🟢 +8.7% 639,149 → 646,112 +1.1%
with defaults 344,918 → 386,673 🟢 +12.1% 348,293 → 350,276 +0.6%
with renaming 302,906 → 362,719 🟢 +19.7% 753,572 → 761,077 +1.0%
nested object destructuring 135,971 → 155,015 🟢 +14.0% 299,181 → 301,246 +0.7%
rest properties 185,367 → 206,707 🟢 +11.5% 241,699 → 236,478 -2.2%
object parameter 90,846 → 103,388 🟢 +13.8% 219,070 → 211,419 -3.5%
array parameter 120,884 → 134,802 🟢 +11.5% 436,710 → 431,176 -1.3%
mixed destructuring in map 34,495 → 38,086 🟢 +10.4% 40,040 → 40,228 +0.5%
forEach with array destructuring 62,908 → 68,588 🟢 +9.0% 208,197 → 207,387 -0.4%
map with array destructuring 63,691 → 71,700 🟢 +12.6% 258,726 → 255,459 -1.3%
filter with array destructuring 66,122 → 75,545 🟢 +14.3% 300,922 → 313,105 +4.0%
reduce with array destructuring 70,882 → 80,695 🟢 +13.8% 270,632 → 276,735 +2.3%
map with object destructuring 77,246 → 87,648 🟢 +13.5% 82,955 → 81,027 -2.3%
map with nested destructuring 63,419 → 70,899 🟢 +11.8% 68,973 → 68,732 -0.3%
map with rest in destructuring 35,773 → 41,471 🟢 +15.9% 24,939 → 24,074 -3.5%
map with defaults in destructuring 58,021 → 64,816 🟢 +11.7% 42,571 → 41,726 -2.0%
fibonacci.js — Interp: 🟢 4, 4 unch. · avg +7.4% · Bytecode: 8 unch. · avg +1.9%
Benchmark Interpreted Δ Bytecode Δ
recursive fib(15) 308 → 328 +6.4% 1,450 → 1,444 -0.4%
recursive fib(20) 28 → 30 +6.6% 131 → 133 +1.4%
recursive fib(15) typed 309 → 338 🟢 +9.3% 1,945 → 1,973 +1.4%
recursive fib(20) typed 28 → 30 +6.4% 176 → 180 +2.1%
iterative fib(20) via reduce 12,168 → 12,716 +4.5% 9,565 → 10,077 +5.4%
iterator fib(20) 9,084 → 9,829 🟢 +8.2% 17,296 → 17,349 +0.3%
iterator fib(20) via Iterator.from + take 14,635 → 16,077 🟢 +9.9% 18,508 → 19,511 +5.4%
iterator fib(20) last value via reduce 11,099 → 11,990 🟢 +8.0% 14,301 → 14,259 -0.3%
for-of.js — Interp: 🟢 6, 1 unch. · avg +10.3% · Bytecode: 7 unch. · avg +1.2%
Benchmark Interpreted Δ Bytecode Δ
for...of with 10-element array 42,799 → 46,889 🟢 +9.6% 169,780 → 169,259 -0.3%
for...of with 100-element array 4,873 → 5,406 🟢 +10.9% 24,805 → 24,938 +0.5%
for...of with string (10 chars) 31,923 → 35,471 🟢 +11.1% 134,677 → 135,793 +0.8%
for...of with Set (10 elements) 43,243 → 47,636 🟢 +10.2% 179,179 → 181,214 +1.1%
for...of with Map entries (10 entries) 28,519 → 30,409 +6.6% 47,148 → 47,794 +1.4%
for...of with destructuring 36,672 → 40,824 🟢 +11.3% 78,372 → 81,147 +3.5%
for-await-of with sync array 40,553 → 45,501 🟢 +12.2% 140,110 → 142,086 +1.4%
iterators.js — Interp: 🟢 11, 9 unch. · avg +7.5% · Bytecode: 20 unch. · avg +0.6%
Benchmark Interpreted Δ Bytecode Δ
Iterator.from({next}).toArray() — 20 elements 14,534 → 16,084 🟢 +10.7% 19,017 → 19,143 +0.7%
Iterator.from({next}).toArray() — 50 elements 6,388 → 7,012 🟢 +9.8% 8,265 → 8,345 +1.0%
spread pre-wrapped iterator — 20 elements 10,626 → 12,012 🟢 +13.0% 18,002 → 18,627 +3.5%
Iterator.from({next}).forEach — 50 elements 4,517 → 4,855 🟢 +7.5% 6,076 → 6,184 +1.8%
Iterator.from({next}).reduce — 50 elements 4,488 → 4,885 🟢 +8.8% 5,615 → 5,776 +2.9%
wrap array iterator 166,785 → 185,237 🟢 +11.1% 117,325 → 117,369 +0.0%
wrap plain {next()} object 10,263 → 11,186 🟢 +9.0% 14,428 → 13,486 -6.5%
map + toArray (50 elements) 4,586 → 4,968 🟢 +8.3% 6,496 → 6,255 -3.7%
filter + toArray (50 elements) 4,472 → 4,811 🟢 +7.6% 6,269 → 6,096 -2.8%
take(10) + toArray (50 element source) 26,723 → 29,096 🟢 +8.9% 31,771 → 33,006 +3.9%
drop(40) + toArray (50 element source) 6,355 → 6,992 🟢 +10.0% 9,217 → 9,833 +6.7%
chained map + filter + take (100 element source) 8,407 → 8,889 +5.7% 10,543 → 10,560 +0.2%
some + every (50 elements) 2,657 → 2,814 +5.9% 3,727 → 3,833 +2.9%
find (50 elements) 5,808 → 6,097 +5.0% 7,642 → 7,974 +4.3%
array.values().map().filter().toArray() 8,950 → 9,286 +3.8% 10,562 → 10,383 -1.7%
array.values().take(5).toArray() 204,840 → 216,805 +5.8% 152,052 → 149,794 -1.5%
array.values().drop(45).toArray() 192,268 → 204,267 +6.2% 144,829 → 144,998 +0.1%
map.entries() chained helpers 10,483 → 10,990 +4.8% 5,792 → 5,762 -0.5%
set.values() chained helpers 18,218 → 19,308 +6.0% 22,152 → 22,120 -0.1%
string iterator map + toArray 13,590 → 13,991 +3.0% 23,142 → 23,463 +1.4%
json.js — Interp: 🟢 18, 2 unch. · avg +9.5% · Bytecode: 🟢 2, 🔴 1, 17 unch. · avg -0.4%
Benchmark Interpreted Δ Bytecode Δ
parse simple object 159,368 → 176,390 🟢 +10.7% 151,960 → 151,040 -0.6%
parse nested object 95,700 → 105,817 🟢 +10.6% 99,203 → 96,475 -2.8%
parse array of objects 50,241 → 55,085 🟢 +9.6% 51,847 → 49,394 -4.7%
parse large flat object 45,691 → 50,562 🟢 +10.7% 45,205 → 44,987 -0.5%
parse mixed types 65,775 → 74,014 🟢 +12.5% 63,041 → 64,067 +1.6%
stringify simple object 197,095 → 210,482 +6.8% 164,858 → 177,452 🟢 +7.6%
stringify nested object 104,823 → 114,125 🟢 +8.9% 92,363 → 95,284 +3.2%
stringify array of objects 61,299 → 60,332 -1.6% 52,428 → 53,138 +1.4%
stringify mixed types 83,971 → 90,965 🟢 +8.3% 77,652 → 78,327 +0.9%
reviver doubles numbers 41,762 → 46,795 🟢 +12.1% 48,759 → 45,671 -6.3%
reviver filters properties 36,878 → 42,123 🟢 +14.2% 50,210 → 47,228 -5.9%
reviver on nested object 48,791 → 52,620 🟢 +7.8% 49,181 → 54,613 🟢 +11.0%
reviver on array 27,856 → 30,701 🟢 +10.2% 30,674 → 27,789 🔴 -9.4%
replacer function doubles numbers 45,989 → 50,580 🟢 +10.0% 53,946 → 54,516 +1.1%
replacer function excludes properties 57,951 → 63,668 🟢 +9.9% 67,696 → 66,252 -2.1%
array replacer (allowlist) 112,272 → 120,193 🟢 +7.1% 103,200 → 104,866 +1.6%
stringify with 2-space indent 92,532 → 103,670 🟢 +12.0% 82,887 → 85,050 +2.6%
stringify with tab indent 94,425 → 103,097 🟢 +9.2% 89,975 → 89,148 -0.9%
parse then stringify 50,262 → 55,850 🟢 +11.1% 53,205 → 52,356 -1.6%
stringify then parse 29,982 → 33,156 🟢 +10.6% 31,565 → 30,074 -4.7%
jsx.jsx — Interp: 🟢 19, 2 unch. · avg +11.6% · Bytecode: 🔴 7, 14 unch. · avg -5.7%
Benchmark Interpreted Δ Bytecode Δ
simple element 195,431 → 217,575 🟢 +11.3% 754,658 → 742,049 -1.7%
self-closing element 203,668 → 221,937 🟢 +9.0% 828,985 → 756,395 🔴 -8.8%
element with string attribute 163,205 → 186,236 🟢 +14.1% 548,746 → 536,638 -2.2%
element with multiple attributes 143,588 → 162,463 🟢 +13.1% 494,112 → 457,659 🔴 -7.4%
element with expression attribute 154,525 → 174,336 🟢 +12.8% 538,721 → 520,482 -3.4%
text child 198,716 → 209,690 +5.5% 792,649 → 737,765 -6.9%
expression child 191,870 → 214,523 🟢 +11.8% 751,454 → 704,360 -6.3%
mixed text and expression 181,785 → 192,229 +5.7% 737,493 → 674,267 🔴 -8.6%
nested elements (3 levels) 73,801 → 80,160 🟢 +8.6% 300,218 → 276,994 🔴 -7.7%
sibling children 55,332 → 60,477 🟢 +9.3% 232,338 → 211,319 🔴 -9.0%
component element 137,655 → 159,567 🟢 +15.9% 512,665 → 496,468 -3.2%
component with children 85,769 → 95,928 🟢 +11.8% 337,317 → 310,889 🔴 -7.8%
dotted component 113,959 → 135,400 🟢 +18.8% 386,463 → 374,526 -3.1%
empty fragment 207,565 → 225,853 🟢 +8.8% 822,915 → 754,165 🔴 -8.4%
fragment with children 54,477 → 59,291 🟢 +8.8% 227,446 → 212,653 -6.5%
spread attributes 101,498 → 116,025 🟢 +14.3% 133,382 → 126,575 -5.1%
spread with overrides 87,435 → 100,108 🟢 +14.5% 100,863 → 96,450 -4.4%
shorthand props 148,782 → 167,001 🟢 +12.2% 530,295 → 508,192 -4.2%
nav bar structure 25,042 → 27,780 🟢 +10.9% 97,757 → 91,290 -6.6%
card component tree 29,204 → 32,841 🟢 +12.5% 108,561 → 103,516 -4.6%
10 list items via Array.from 13,445 → 15,167 🟢 +12.8% 26,287 → 25,383 -3.4%
numbers.js — Interp: 🟢 9, 2 unch. · avg +8.7% · Bytecode: 11 unch. · avg -2.3%
Benchmark Interpreted Δ Bytecode Δ
integer arithmetic 523,627 → 531,150 +1.4% 2,040,505 → 2,036,122 -0.2%
floating point arithmetic 538,340 → 582,840 🟢 +8.3% 2,291,639 → 2,266,222 -1.1%
number coercion 173,716 → 193,953 🟢 +11.6% 174,152 → 166,585 -4.3%
toFixed 97,482 → 107,469 🟢 +10.2% 229,991 → 228,171 -0.8%
toString 150,804 → 161,945 🟢 +7.4% 868,615 → 871,296 +0.3%
valueOf 218,304 → 240,288 🟢 +10.1% 1,318,388 → 1,308,864 -0.7%
toPrecision 139,198 → 143,960 +3.4% 463,146 → 462,234 -0.2%
Number.isNaN 309,694 → 343,063 🟢 +10.8% 226,029 → 219,132 -3.1%
Number.isFinite 307,392 → 334,287 🟢 +8.7% 232,696 → 217,696 -6.4%
Number.isInteger 305,244 → 341,007 🟢 +11.7% 240,468 → 229,665 -4.5%
Number.parseInt and parseFloat 239,748 → 269,159 🟢 +12.3% 186,652 → 178,428 -4.4%
objects.js — Interp: 🟢 4, 3 unch. · avg +6.4% · Bytecode: 7 unch. · avg -0.0%
Benchmark Interpreted Δ Bytecode Δ
create simple object 446,815 → 500,494 🟢 +12.0% 989,195 → 1,003,279 +1.4%
create nested object 207,539 → 231,143 🟢 +11.4% 435,868 → 428,748 -1.6%
create 50 objects via Array.from 8,842 → 9,542 🟢 +7.9% 9,155 → 8,932 -2.4%
property read 577,919 → 587,599 +1.7% 820,339 → 818,099 -0.3%
Object.keys 284,986 → 286,150 +0.4% 206,582 → 204,295 -1.1%
Object.entries 98,432 → 102,190 +3.8% 72,149 → 74,167 +2.8%
spread operator 170,780 → 183,389 🟢 +7.4% 196,878 → 199,018 +1.1%
promises.js — Interp: 🟢 4, 8 unch. · avg +5.6% · Bytecode: 🔴 1, 11 unch. · avg -3.8%
Benchmark Interpreted Δ Bytecode Δ
Promise.resolve(value) 515,249 → 557,128 🟢 +8.1% 381,090 → 386,721 +1.5%
new Promise(resolve => resolve(value)) 186,848 → 188,936 +1.1% 172,525 → 163,548 -5.2%
Promise.reject(reason) 520,996 → 538,283 +3.3% 369,654 → 355,007 -4.0%
resolve + then (1 handler) 163,824 → 172,058 +5.0% 162,742 → 152,612 -6.2%
resolve + then chain (3 deep) 63,706 → 69,614 🟢 +9.3% 69,817 → 64,759 🔴 -7.2%
resolve + then chain (10 deep) 20,152 → 21,322 +5.8% 23,384 → 21,971 -6.0%
reject + catch + then 91,792 → 100,400 🟢 +9.4% 100,011 → 98,358 -1.7%
resolve + finally + then 78,416 → 85,253 🟢 +8.7% 86,429 → 81,851 -5.3%
Promise.all (5 resolved) 29,836 → 31,037 +4.0% 29,267 → 27,556 -5.8%
Promise.race (5 resolved) 31,739 → 32,442 +2.2% 29,369 → 29,548 +0.6%
Promise.allSettled (5 mixed) 24,788 → 26,056 +5.1% 23,693 → 22,995 -2.9%
Promise.any (5 mixed) 29,131 → 30,570 +4.9% 27,878 → 26,861 -3.7%
strings.js — Interp: 🟢 2, 🔴 1, 8 unch. · avg +3.4% · Bytecode: 🔴 1, 10 unch. · avg -1.0%
Benchmark Interpreted Δ Bytecode Δ
string concatenation 396,393 → 375,747 -5.2% 417,581 → 392,259 -6.1%
template literal 674,090 → 602,371 🔴 -10.6% 759,352 → 753,191 -0.8%
string repeat 383,206 → 423,961 🟢 +10.6% 1,065,623 → 1,094,535 +2.7%
split and join 130,501 → 135,819 +4.1% 332,863 → 329,279 -1.1%
indexOf and includes 160,187 → 173,029 🟢 +8.0% 745,562 → 755,722 +1.4%
toUpperCase and toLowerCase 244,366 → 258,036 +5.6% 826,870 → 745,735 🔴 -9.8%
slice and substring 154,263 → 160,023 +3.7% 859,477 → 875,557 +1.9%
trim operations 188,717 → 194,305 +3.0% 684,574 → 669,267 -2.2%
replace and replaceAll 195,715 → 208,855 +6.7% 638,961 → 630,769 -1.3%
startsWith and endsWith 132,011 → 138,063 +4.6% 643,438 → 668,451 +3.9%
padStart and padEnd 188,793 → 201,359 +6.7% 692,077 → 692,103 +0.0%
typed-arrays.js — Interp: 🟢 8, 14 unch. · avg +4.7% · Bytecode: 🔴 2, 20 unch. · avg -3.1%
Benchmark Interpreted Δ Bytecode Δ
new Int32Array(0) 319,582 → 311,246 -2.6% 141,561 → 138,837 -1.9%
new Int32Array(100) 290,177 → 292,269 +0.7% 137,755 → 133,223 -3.3%
new Int32Array(1000) 169,033 → 191,452 🟢 +13.3% 82,603 → 81,570 -1.3%
new Float64Array(100) 266,563 → 271,842 +2.0% 122,126 → 118,607 -2.9%
Int32Array.from([...]) 177,494 → 193,459 🟢 +9.0% 170,729 → 168,380 -1.4%
Int32Array.of(1, 2, 3, 4, 5) 309,618 → 304,431 -1.7% 276,353 → 254,538 🔴 -7.9%
sequential write 100 elements 3,477 → 3,541 +1.8% 15,425 → 14,552 -5.7%
sequential read 100 elements 3,554 → 3,586 +0.9% 11,540 → 10,902 -5.5%
Float64Array write 100 elements 3,100 → 3,382 🟢 +9.1% 14,649 → 13,572 🔴 -7.3%
fill(42) 46,372 → 54,677 🟢 +17.9% 45,099 → 44,793 -0.7%
slice() 204,533 → 210,542 +2.9% 191,865 → 184,044 -4.1%
map(x => x * 2) 8,003 → 7,867 -1.7% 8,350 → 7,970 -4.5%
filter(x => x > 50) 8,463 → 8,243 -2.6% 8,698 → 8,500 -2.3%
reduce (sum) 7,780 → 7,461 -4.1% 7,398 → 7,156 -3.3%
sort() 167,552 → 201,630 🟢 +20.3% 153,870 → 152,424 -0.9%
indexOf() 430,387 → 494,788 🟢 +15.0% 378,040 → 366,135 -3.1%
reverse() 333,841 → 359,591 🟢 +7.7% 284,319 → 280,419 -1.4%
create view over existing buffer 407,368 → 401,877 -1.3% 158,764 → 153,446 -3.3%
subarray() 442,431 → 457,734 +3.5% 378,657 → 364,262 -3.8%
set() from array 566,946 → 599,682 +5.8% 281,753 → 275,009 -2.4%
for-of loop 4,747 → 4,715 -0.7% 21,265 → 21,305 +0.2%
spread into array 15,373 → 16,572 🟢 +7.8% 49,486 → 48,491 -2.0%

Measured on ubuntu-latest x64. Changes within ±7% are considered insignificant.

@github-actions

github-actions Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Suite Timing

Suite Metric Interpreted Bytecode
Tests Total 3501 3501
Tests Passed 3460 ✅ 3501 ✅
Tests Skipped 41 0
Tests Execution 162.9ms 166.6ms
Tests Engine 312.9ms 590.6ms
Benchmarks Total 254 254
Benchmarks Duration 6.73min 12.01min

Measured on ubuntu-latest x64.

- Rewrite optimization-log.md with correct PR numbers for all 22 PRs
  since #73 (previous version had multiple wrong PR-to-description
  mappings)
- Add missing PRs: #73, #74, #75, #76, #77, #79, #80, #81, #82, #83,
  #85, #88, #89, plus infrastructure PRs #90, #92, #98
- Fix GC section: Collect-after-each-file is deliberate, not a
  workaround; any GC revisit needs fresh analysis
- Fix minor items: link to actual issues #103 and #104, correct naming
  convention context (shared units should NOT use Goccia.* prefix)
- Create docs/decision-log.md with 1-3 sentence summaries linking to
  detailed documentation
- Link fpc-generics-performance.md and fpc-dispatch-performance.md
  from AGENTS.md, code-style.md, design-decisions.md, and
  optimization-log.md

Made-with: Cursor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/optimization-log.md`:
- Line 238: The PR reference in "Key Insight `#4`" incorrectly attributes the
boolean opcode promotion to PR `#88`; update the line in docs/optimization-log.md
(the sentence mentioning "promoting boolean opcodes") to point to the correct PR
number that implemented boolean opcode promotion or remove the PR reference if
you're unsure of the exact PR, ensuring the text no longer cross-references PR
`#88` which is about async/await.
- Around line 45-46: Update the contradictory statement about decorator
compilation: change the claim that "All decorated classes are compiled natively
via GOCCIA_EXT_BEGIN_DECORATORS / APPLY_ELEMENT_DECORATOR / FINISH_DECORATORS"
to reflect that decorated classes are deferred to the interpreter using
FPendingClasses and GOCCIA_EXT_EVAL_CLASS / EvaluateClassByIndex because
IsSimpleClass always returned True previously; ensure the doc consistently
describes the deferred path (FPendingClasses + GOCCIA_EXT_EVAL_CLASS /
EvaluateClassByIndex) and remove or reword any remaining assertion that
decorated classes are compiled natively (references:
GOCCIA_EXT_BEGIN_DECORATORS, APPLY_ELEMENT_DECORATOR, FINISH_DECORATORS,
IsSimpleClass, GOCCIA_EXT_EVAL_CLASS, EvaluateClassByIndex, FPendingClasses).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cf607dfe-bd6c-4f5d-a852-80f07847034d

📥 Commits

Reviewing files that changed from the base of the PR and between 27ab88b and f35ac64.

📒 Files selected for processing (5)
  • AGENTS.md
  • docs/code-style.md
  • docs/decision-log.md
  • docs/design-decisions.md
  • docs/optimization-log.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/code-style.md

Comment thread docs/optimization-log.md Resolved
Comment thread docs/optimization-log.md Resolved
- Fix generics spike ratio values (arithmetic errors from original PDF)
- Change "13 characters" to "13 bytes" in souffle-vm.md (FPC string[N]
  is byte-counted), add UTF-8 note
- Mark TScopeMap as removed/historical in hashmap spike document
- Fix Key Insight #4 PR reference (was #88 async/await, not boolean)
- Remove stale GOCCIA_EXT_EVAL_CLASS / FPendingClasses / decorator
  bridge references from AGENTS.md, souffle-vm.md, design-decisions.md
  (decorators are now compiled natively via BEGIN/APPLY/FINISH opcodes)
- Fix "44 second" → "44-second" hyphenation in string spike

Made-with: Cursor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
docs/spikes/fpc-hashmap-performance.md (1)

67-68: ⚠️ Potential issue | 🟠 Major

Remove remaining normative TScopeMap guidance from historical section.

These lines still read as current recommendation (“sweet spot” / “overall recommendations unchanged”), which conflicts with the March 2026 update and current implementation.

[suggested patch]

🛠️ Suggested wording adjustment
-TScopeMap wins at N=10 (1.5× faster) where linear scan has less overhead than hashing. At N=30 the O(n) scan crosses over and TDictionary's O(1) amortised lookup wins. The sweet spot for TScopeMap is scopes with fewer than ~20 bindings, which covers the vast majority of real-world function scopes. Its Resolve and Assign methods provide chain-walking semantics that no hash map can replicate.
+Historically, TScopeMap won at N=10 (1.5× faster) where linear scan had less overhead than hashing. At N=30 the O(n) scan crossed over and hash-based lookup won. This is baseline data only: TScopeMap has been removed, and current scope bindings use `TOrderedStringMap<TLexicalBinding>` with recursive parent walking in `TGocciaScope`.
@@
-- **Original benchmarks remain valid.** The benchmarks in sections 3.1–3.5 remain valid for the general comparison; the updates only affected implementation details, not the overall recommendations.
+- **Original benchmarks are historical baseline data.** The benchmark data remains useful for comparison, but scope-binding recommendations are superseded by the March 2026 architecture update.

Based on learnings: units/ScopeMap.pas was deleted, and scope bindings now use TOrderedStringMap<TLexicalBinding> with recursive TGocciaScope walking.

Also applies to: 426-426

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/spikes/fpc-hashmap-performance.md` around lines 67 - 68, Remove the
remaining normative recommendation language about TScopeMap (mentions like
“sweet spot for TScopeMap”, “Resolve and Assign” semantics, and comparisons to
TDictionary) and replace it with a brief historical note stating that TScopeMap
and units/ScopeMap.pas were removed and that scope bindings now use
TOrderedStringMap<TLexicalBinding> with recursive TGocciaScope walking; update
any language that implies active recommendation (e.g., references to
Resolve/Assign or performance sweet spots) to reflect that this is historical
context only and not current guidance.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@docs/spikes/fpc-hashmap-performance.md`:
- Around line 67-68: Remove the remaining normative recommendation language
about TScopeMap (mentions like “sweet spot for TScopeMap”, “Resolve and Assign”
semantics, and comparisons to TDictionary) and replace it with a brief
historical note stating that TScopeMap and units/ScopeMap.pas were removed and
that scope bindings now use TOrderedStringMap<TLexicalBinding> with recursive
TGocciaScope walking; update any language that implies active recommendation
(e.g., references to Resolve/Assign or performance sweet spots) to reflect that
this is historical context only and not current guidance.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8f643d1-2a78-4608-a970-fb212adb604b

📥 Commits

Reviewing files that changed from the base of the PR and between f35ac64 and 5e65a92.

📒 Files selected for processing (7)
  • AGENTS.md
  • docs/design-decisions.md
  • docs/optimization-log.md
  • docs/souffle-vm.md
  • docs/spikes/fpc-generics-performance.md
  • docs/spikes/fpc-hashmap-performance.md
  • docs/spikes/fpc-string-performance.md

The spike originally recommended TScopeMap for scope bindings based on
micro-benchmarks at N≤10. After implementation (PR #66), real-world
profiling showed the assumption about scope sizes was incorrect — global
and bridged scopes far exceed 20 bindings, causing a 2.7× regression.
The update section now tells the complete timeline: original
recommendation → implementation → profiling discovery → revert.

Made-with: Cursor
Introduce a new 'grill-me' agent skill that relentlessly interviews users about a plan or design, exploring each branch of the decision tree until a shared understanding is reached and dependencies are resolved. The skill prefers to inspect the codebase when that can answer a question. Updated skills lock to include the new skill.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
docs/spikes/fpc-hashmap-performance.md (1)

7-7: Minor: Spelling consistency (optimise vs optimize).

Line 7 uses "optimised" (British spelling) while line 434 uses "optimized" (American spelling). Consider standardizing to one variant throughout the document for consistency.

Also applies to: 434-434

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/spikes/fpc-hashmap-performance.md` at line 7, The document uses both
"optimised" and "optimized"; pick one spelling (e.g., use "optimized" to match
line 434) and make all occurrences consistent by replacing "optimised" with
"optimized" (or vice versa if you prefer British spelling) throughout the file;
search for the tokens "optimised" and "optimized" and update every match in the
docs/spikes/fpc-hashmap-performance.md content to the chosen variant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/spikes/fpc-hashmap-performance.md`:
- Line 7: The document uses both "optimised" and "optimized"; pick one spelling
(e.g., use "optimized" to match line 434) and make all occurrences consistent by
replacing "optimised" with "optimized" (or vice versa if you prefer British
spelling) throughout the file; search for the tokens "optimised" and "optimized"
and update every match in the docs/spikes/fpc-hashmap-performance.md content to
the chosen variant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d6b36d1-756c-4053-a318-1848a996f789

📥 Commits

Reviewing files that changed from the base of the PR and between 5e65a92 and 09bca7e.

📒 Files selected for processing (1)
  • docs/spikes/fpc-hashmap-performance.md

@frostney
frostney merged commit b13f709 into main Mar 18, 2026
9 checks passed
@frostney
frostney deleted the docs/update-vm-bytecode-docs branch March 18, 2026 22:27
@frostney frostney added the internal Refactoring, CI, tooling, cleanup label Apr 9, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Refactoring, CI, tooling, cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant