Menu

Post image 1
Post image 2
1 / 2
0

We Measured It: LSP Saves AI Agents 5-34x Tokens vs Grep

DEV Community·Dayna Blackwell·24 days ago
#Nrz91fpm
#ai#opensource#grep#agent#codebase#file
Reading 0:00
15s threshold

We renamed a function across 24 files in a TypeScript codebase. The grep approach ingested 492,954 bytes to accomplish it: grep to find all occurrences, read each file to understand context, replace, build to verify, read build output. The LSP approach ingested 342 bytes. One rename_symbol call returned a structured workspace edit. That's 1,441x fewer tokens for the exact same operation. The experiment We built a reproducible Go script that measures the actual byte cost of common code intelligence tasks using two approaches: Grep/Read : what AI agents do today. Grep for a symbol, read the file, grep again, read context. This is how every agent without LSP navigates code. LSP : structured queries to a language server. Get exactly the information needed, in a machine-readable format, with zero false positives. For each task, we measure total bytes that enter the agent's context window on both sides. The ratio is the savings.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More