Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,18 @@ Current response responsibilities:

## Benchmarks

Published benchmark numbers were intentionally removed from the docs until they are rerun.
The stock cache-miss E2E harness ran on an AMD Ryzen 9 5950X with 32 logical
CPUs. `main` commit `145b36c6b86621dccfe965926b0ef501ffd33b06` and Finder
candidate commit `e176fef31432ed36dc101471dfa1c94cc1650908` each completed
the default 112-cell matrix twice for Finder (10 GiB per cell, 728,320-byte
articles, article-only mix, pipeline depth 32). The fresh main control's
equal-weight mean was 3,546.6 MiB/s; Finder repeats were 3,564.3 MiB/s
(+0.5%) and 3,560.8 MiB/s (+0.4%). Their paired medians were -0.4% and
+0.4%, geometric means +0.6% and -0.5%, and win/loss counts 50/62 and 63/49.
Measured proxy CPU changed -0.8% then +0.2%. The fresh main control was 0.8%
above the older main baseline. The repeats have substantial per-cell spread,
so they do not demonstrate a reliable end-to-end speedup. The fresh CSVs are
retained locally and are not committed.

When you want fresh numbers:

Expand Down
8 changes: 7 additions & 1 deletion src/session/multiline_framing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use std::borrow::Cow;
use std::collections::VecDeque;
use std::ops::Range;
use std::sync::LazyLock;

use anyhow::Context;
use smallvec::SmallVec;
Expand All @@ -20,6 +21,9 @@ const TERMINATOR: &[u8; 5] = b"\r\n.\r\n";
const TERMINATOR_TAIL_SIZE: usize = 4;
const MAX_CAPTURED_MULTILINE_RESPONSE_BYTES: usize = 4 * 1024 * 1024;

static TERMINATOR_FINDER: LazyLock<memchr::memmem::Finder<'static>> =
LazyLock::new(|| memchr::memmem::Finder::new(TERMINATOR));

#[must_use]
pub(crate) fn cached_response_completion() -> std::io::IoSlice<'static> {
std::io::IoSlice::new(TERMINATOR)
Expand Down Expand Up @@ -2056,7 +2060,9 @@ fn find_terminator_end(data: &[u8]) -> Option<usize> {

#[inline]
fn terminator_ends(data: &[u8]) -> impl Iterator<Item = usize> + '_ {
memchr::memmem::find_iter(data, TERMINATOR).map(|found| found + TERMINATOR.len())
TERMINATOR_FINDER
.find_iter(data)
.map(|found| found + TERMINATOR.len())
}

#[inline]
Expand Down
Loading