mirror of
https://github.com/zotero/zotero.git
synced 2026-10-09 03:18:01 +00:00
Mirror of https://github.com/zotero/zotero.git
Previously, macros referenced by sort keys were expanded inline into the sort token array every time they were encountered. Non-sort macros were already cached in state.macros[name] and referenced via closures, but sort-mode macros were duplicated across sort keys. With a complex style like chicago-shortened-notes-bibliography (155 macros, 6 macro-based sort keys), this produced 179,605 tokens and 355,652 closures in bibliography_sort alone -- 99.9% of all tokens. This commit caches sort-mode macro expansions in state.sort_macros[name] using the same closure-reference approach as non-sort macros. In addition to the memory savings, avoiding the redundant macro expansion makes engine initialization dramatically faster with complex styles. Results with chicago-shortened-notes-bibliography: - Engine initialization: 464 ms -> 57 ms (8x faster) - Per-engine heap (Node.js): 123 MB -> 6.7 MB (94.6% reduction) - Resident per engine (Firefox): ~140 MB -> ~7 MB - Total tokens: 187,893 -> 11,669 (93.8% reduction) - Total closures: 370,982 -> 21,823 (94.1% reduction) - All 1,502 citeproc-js tests pass (at f88a47e6) - Same 1501/1505 pass on master (same 4 pre-existing failures) |
||
|---|---|---|
| .github/workflows | ||
| app | ||
| chrome | ||
| defaults/preferences | ||
| js-build | ||
| note-editor@00f8c2d794 | ||
| pdf-worker@fd642b3828 | ||
| reader@584c698ead | ||
| resource | ||
| scripts | ||
| scss | ||
| styles@86e08aba49 | ||
| test | ||
| translators@92d17b1210 | ||
| types/gecko | ||
| .babelrc | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| chrome.manifest | ||
| CLAUDE.md | ||
| CONTRIBUTING.md | ||
| COPYING | ||
| eslint.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| update.rdf | ||
| version | ||
Zotero
Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.
Please post feature requests or bug reports to the Zotero Forums. If you're having trouble with Zotero, see Getting Help.
For more information on how to use this source code, see the Zotero documentation.