compress-on-input Performance Report

Real-world compression statistics from 11 days of daily use with Claude Code

March 6–16, 2026 3,257 tool calls 0 errors
93.4%
Overall reduction
9.9M
Tokens saved
$148
Saved (Opus pricing)
15ms
Median latency

Compression by Content Type

Screenshots → OCR
99.8%
181 screenshots processed via Apple Vision OCR. Base64 image data replaced with extracted text. Avg OCR time: 735ms.
~210k chars ~425 chars
JSON / DB Results
98.6%
60 large JSON responses collapsed to schema + 3 sample rows. Avg time: 1ms.
~9.6k chars ~137 chars
Large Text
50.0%
1 large text document truncated via BM25-ranked chunking. Head + relevant middle + tail preserved.
533k chars 266k chars
DOM Snapshots
24%
1,761 accessibility tree snapshots cleaned up. Most frequent type. Ref mapping preserved for clickability.
~1.8k chars ~1.4k chars

Token Savings Breakdown

Where the 9.9 million saved tokens came from:

Screenshots → OCR
9.5M tokens
95.9%
DOM snapshots
190k tokens
1.9%
JSON / DB
142k tokens
1.4%
Large text
67k tokens
0.7%

Per-Tool Breakdown

Tool Compressed Passed Through Total Before Total After Reduction Avg Latency
browser_take_screenshot 181 38.0M 77k 99.8% 735ms
browser_click 604 39 701k 557k 20.6% 19ms
browser_navigate 458 28 560k 422k 24.6% 28ms
browser_snapshot 383 36 1.2M 863k 27.1% 20ms
browser_wait_for 205 40 638k 495k 22.3% 21ms
browser_evaluate 3 297 2.6k 2.6k 0.3% 16ms
browser_run_code 39 272 27k 27k 0.5% 26ms
db_query 36 534k 4.9k 99.1% 1ms
notion-search 4 19.5k 1.5k 92.3% 22ms
query (D1) 12 18.6k 1.1k 94.0% 10ms

DOM Snapshot Compression Distribution

1,761 DOM snapshots — how much each one was reduced:

<5% reduction
230
13.1%
5–15% reduction
426
24.2%
15–30% reduction
794
45.1%
30–50% reduction
301
17.1%
>50% reduction
10
0.6%

Screenshot OCR Quality

181 screenshots processed — quality of extracted text:

Rich (>500 chars)
63
34.8%
Medium (200–500)
57
31.5%
Short (<200 chars)
61
33.7%
Empty (<50 chars)
0
0.0%

Zero empty OCR results — every screenshot produced usable text. "Short" results are typically screenshots with minimal text content (dialogs, confirmations, loading states).

Daily Activity

Compressed events per day and chars saved:

Mar 6: 23 events, 294k saved
Mar 7: 119 events, 3.0M saved
Mar 8: 136 events, 9.2M saved
Mar 9: 255 events, 7.0M saved
Mar 10: 621 events, 6.2M saved
Mar 11: 373 events, 8.0M saved
Mar 12: 16 events, 1.1M saved
Mar 13: 72 events, 59k saved
Mar 14: 44 events, 621k saved
Mar 15: 284 events, 121k saved
Mar 16: 60 events, 3.9M saved
Mar 678910 111213141516

Latency Profile

By operation type

DOM cleanup
20ms
JSON collapse
1ms
Text truncate
58ms
OCR (cached)
735ms
OCR (first call)
~3s

Overall percentiles

Median (P50)
15ms
P95
559ms
Max
6.6s
Mean
86ms
28 operations exceeded 1 second — all screenshot OCR. The 6.6s max was the first-ever OCR call (Swift binary compilation).

Beyond Size Reduction — Quality of Life

Compression isn't just about tokens. It changes how Claude interacts with data.

Screenshots become searchable text

Instead of a 210k-char base64 blob that Claude processes as an image, it receives semantic text. Claude can search, compare, quote, and reason about page content across multiple screenshots.

Before: data:image/png;base64,iVBORw0KGgo... (210k chars)

After: Dashboard — Revenue: $45,230 (+12.3%)
Active Users: 1,847 | Conversion: 3.2%
Top Campaign: "Spring Sale" — 234 signups

DB queries return schema, not noise

500-row query results become schema + 3 examples. For understanding structure, writing follow-up queries, or debugging — the schema is more useful than scrolling through raw data.

Before: [{"id":1,"name":"Alice","email":"a@..."}, {"id":2,...}, ... × 500 rows]

After: Array[500] of {id, name, email, created_at, role}
Sample: {id: 1, name: "Alice", email: "a@b.com", role: "admin"}
Sample: {id: 2, name: "Bob", ...}

DOM stays clickable, less noisy

Inline [ref=eNN] markers are extracted into a compact mapping table. Claude still clicks elements by ref, but the text reads more naturally.

Before: - button [ref=e45] "Submit" [role="button"]
- div [ref=e46] [role="generic"]
  - div [ref=e47] [role="none"]

After: - button "Submit"
Refs: Submit→e45

Smart passthrough prevents data loss

1,254 small results passed through untouched. browser_evaluate, browser_fill_form, browser_type — outputs that are already compact and shouldn't be touched.

Top passthrough tools:
browser_evaluate: 297 ✓
browser_run_code: 272 ✓
browser_press_key: 72 ✓
browser_fill_form: 61 ✓
Small output → no compression needed

Reliability

0
Errors in 3,257 events
3
Negative compressions (max -0.2%)
28
Slow ops (>1s) — all OCR
100%
Uptime (fail-safe design)

The fail-safe design ensures the hook never makes things worse: if compression fails or increases size, the original content is returned unchanged. In 11 days of continuous use, there were zero instances of data loss or corruption.

Top 10 Biggest Single Saves

# Tool Before After Saved Reduction
1browser_take_screenshot471,0371,405469,63299.7%
2browser_take_screenshot430,8141,269429,54599.7%
3browser_take_screenshot430,8101,265429,54599.7%
4browser_take_screenshot375,522960374,56299.7%
5browser_take_screenshot375,517955374,56299.7%
6browser_take_screenshot352,010851351,15999.8%
7browser_take_screenshot349,034791348,24399.8%
8browser_take_screenshot337,3221,014336,30899.7%
9browser_take_screenshot335,167712334,45599.8%
10browser_take_screenshot303,117760302,35799.7%

All top saves are screenshots — a single full-page screenshot can consume ~117k tokens. OCR replaces that with ~300 tokens of text, saving the equivalent of a medium-sized conversation.