Files
codex/codex-rs/tools/benches
Dmitriy Kovalenko 4c153c26c0 Reduce allocations when preparing tool schemas and catalogs (#62849)
## Why

Tool schema budget checks cloned the schema and allocated a JSON buffer
just to measure its size. Building a Responses Lite catalog also cloned
tool definitions before serializing them.

## What changed

- Deserialize schemas from borrowed JSON during compaction, count
  serialized bytes without allocating a buffer, and reuse the parsed
  schema when it fits the budget.
- Serialize borrowed tool specs and namespace members directly, and pass
  filtered specs as an iterator. Preserve the serialized namespace field
  order because the bytes contribute to the `additional_tools` item ID.

## Testing

- Compare the exact serialized Responses Lite catalog against the
  expected namespace layout.
- Add a `tool_catalog` benchmark for connector schema preparation and
  Responses Lite catalog encoding with 1 and 64 tool specs.

GitOrigin-RevId: 6bd03a12fcedd4abfa8c3a03f298243483e98c63
2026-11-20 22:10:45 +00:00
..