Skip to content

Batch embed_text trigram hashing (37-78% of parse_bundle time) #90

Description

@valiantone

Summary

Batch the per-trigram hashing in embed_text — it dominates bundle parse time.

Measured impact (spike #48, PR #84, B3)

embed_text is 37–78% of parse_bundle wall time across bundle trees (100–2500 bundles). It issues one hashlib.md5 call per character trigram (src/hotmem/embed.py:44). A native markdown/parse helper would optimize the wrong 20%; the lever is here.

Proposal

Batch trigram hashing (single hashlib update over a packed buffer, or a cheaper rolling hash), keeping hotmem-hash-v1 embedding semantics bit-compatible — otherwise version the embedding model string.

Acceptance criteria

  • hotmem-hash-v1 vectors unchanged (or model string versioned + migration noted).
  • Measurable parse_bundle speedup on the spike's bundle trees (fixtures reusable).
  • No behavior change for callers.

Context

Spike recommendation follow-up #5: bench/native_spike/README.md. Related: #48, #49.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:snapshotSnapshot v2 directory format, portability, replayenhancementNew feature or requestpriority:p2Do after evidence or dependency gates; optional portability capabilityv0.2.NEXTCommitted for a future 0.2.x release; not yet pinned to 0.2.4/0.2.5v0.2.xHotMem post-v0.2 follow-up work

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions