Optimize unbounded byte scans with memchr#26265
Conversation
8f1acf4 to
15a6c3c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98b972d0ce
ℹ️ 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".
| log = "0.4" | ||
| lru = "0.16.3" | ||
| maplit = "1.0.2" | ||
| memchr = "2.7.6" |
There was a problem hiding this comment.
Refresh the Bazel module lockfile
This commit adds memchr as a new workspace/direct Rust dependency, but the diff does not include a corresponding MODULE.bazel.lock update. The repository rule requires just bazel-lock-update and committing the refreshed lockfile whenever Cargo.toml or Cargo.lock changes (AGENTS.md lines 34-37); otherwise Bazel lockfile checks can reject the change even though Cargo builds resolve the dependency.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think memchr 2.7.6 is already in MODULE.bazel.lock.
fcoury-oai
left a comment
There was a problem hiding this comment.
Did some basic smoke test and worked as expected. Code looks good, approved.
Summary
This PR adds
memchrfor some low-hanging performance improvements (namely, in MCP stdio, Ollama streaming, and full message-history newline counts).Codex produced the following release benchmarks:
With a "real" MCP setup (
ExecutorStdioServerLauncherstarted a Python MCP server, completedinitialize, requestedtools/list, and deserialized a 1 MiB tool description over newline-delimited stdio), it's about 16x faster end-to-end:mainmemchris already in our dependency tree and extremely widely used for this kind of optimized scanning.