Skip to content

MatchTrie: faster Add and match nodes - #161

Merged
Pyrdacor merged 1 commit into
masterfrom
claude/laughing-archimedes-ttjf2s
Oct 25, 2026
Merged

Pyrdacor merged 1 commit into
masterfrom
claude/laughing-archimedes-ttjf2s

Conversation

@Pyrdacor

@Pyrdacor Pyrdacor commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

More speed for the normal LOB compression (-c0) on the Amiga. The compressed data stays the same byte for byte.

  • Add looks up the child itself. It no longer calls _GetChild. The walk already knows whether the current node is a leaf, so _isLeaf is read only once per step.
  • _AddMatchNode appends directly when the offset comes after the last one and there is room, which is almost always.
  • The node arrays start with 4096 entries instead of 1024, so they are copied less often as they grow. This costs about 55 KB more at the start.

AmbermoonPack AMNP ... -c0 under vamos, in cycles:

Data before CShift 0.40 with the next CShift
Floors (17 files, 34.8 KB) 468.3M 436.0M 417.2M
Floors 001-002 (4 KB) 46.6M 43.1M 41.9M

The last column uses the compiler from Robert-Schneckenhaus/CShift#140, which reuses field loads.

Tests with CShift 0.40: Tools/tests/run.sh 104 of 104, --amiga 100 of 100. With the compiler from Robert-Schneckenhaus/CShift#140 the results are the same.

https://claude.ai/code/session_01Pv5d5PKEkVRYs6bvBwitQd


Generated by Claude Code

- Add looks up the child itself (the walk knows whether the node is a
  leaf, so _isLeaf is read once per step and the call goes)
- _AddMatchNode appends directly when the offset is behind the last one
  and there is room (almost always)
- the node arrays start with 4096 entries (fewer copies when they grow)

The compressed data stays the same byte for byte. Floors (34.8 KB, -c0)
under vamos: 468 -> 436 million cycles with CShift 0.40, 417 million
with the next CShift (field loads reused).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pv5d5PKEkVRYs6bvBwitQd
@Pyrdacor
Pyrdacor merged commit cb75332 into master Oct 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant