[codex] Update limonp dependency#236
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5dddb97d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1 +1 @@ | |||
| Subproject commit 9d74077dfcdf8073536c97a00bb79d7a3c3fdaba | |||
| Subproject commit 4065c5f6d5a7a7248aacdd34d738fe0351b97c3f | |||
There was a problem hiding this comment.
Avoid allocating for every DAG entry
With this submodule bump, limonp::LocalVector becomes a std::vector-backed wrapper with default capacity 0. In cppjieba, Trie::Find pushes at least one element into each Dag::nexts for every rune in the input, so the common single-candidate case now performs a heap allocation per character; the previous limonp version kept 16 inline slots and avoided those allocations. For normal Cut calls on long text this can regress the core segmentation hot path, so consider keeping small-vector storage for Dag::nexts or otherwise preallocating/using a different container before taking this update.
Useful? React with 👍 / 👎.
Summary
deps/limonpsubmodule fromv1.0.2(9d74077) to4065c5f, which includes theLocalVectormodernization from Modernize LocalVector helper limonp#44<cassert>include inUnicode.hppWhy
The modernized
LocalVector.hppno longer includes<assert.h>as an implementation detail.Unicode.hppusesassertdirectly, so updating the submodule exposed an existing indirect-include dependency and caused the unit-test build to fail. Including<cassert>at the actual use site makes the dependency explicit.Validation
cmake -S . -B /tmp/cppjieba-limonp-build -DCMAKE_BUILD_TYPE=Releasecmake --build /tmp/cppjieba-limonp-build --parallel 2ctest --test-dir /tmp/cppjieba-limonp-build --output-on-failureResult: 2/2 CTest tests passed.