Skip to content

v3.48.1 — perf(retrieval): memoize tokenization

Choose a tag to compare

@Patdolitse Patdolitse released this 04 Jun 00:38

Engram v3.48.1 is a performance patch. The search-time tokenizer is now memoized: _tokenize delegates to a process-wide @lru_cached pure function keyed on the input text and the static alias tables, so the repeated n-gram + alias work that previously ran for every field of every entry on every query collapses into a dict lookup. Warm full-corpus keyword search drops from ~53ms to ~20ms median (−62%).

There is no behavior change — token sets, alias expansion, and ranking are identical. No telemetry schema, remote service behavior, permission enforcement, user-data migration, or new agent-facing MCP tool changes in this release.


Engram v3.48.1 是一个性能补丁。检索阶段的分词器现在被记忆化:_tokenize 委托给进程级 @lru_cache 的纯函数,缓存键为输入文本与导入期即静态的别名表,于是此前在每次查询时对每条记录的每个字段反复执行的 n-gram + 别名扩展,被折叠为一次字典查找。全量语料的热查询关键词搜索中位数从 ~53ms 降到 ~20ms(−62%)。

无任何行为变化——token 集合、别名扩展、排序完全一致。本版本不改 telemetry schema、不改远端服务行为、不启用权限 enforcement、不迁移用户数据,也不新增面向 agent 的 MCP 工具。