惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
T
Tenable Blog
博客园_首页
S
Securelist
Spread Privacy
Spread Privacy
Google Online Security Blog
Google Online Security Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
U
Unit 42
L
LINUX DO - 热门话题
量子位
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
V2EX - 技术
V2EX - 技术
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
G
Google Developers Blog
F
Full Disclosure
W
WeLiveSecurity
宝玉的分享
宝玉的分享
腾讯CDC
G
GRAHAM CLULEY
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
We Measured It: LSP Saves AI Agents 5-34x Tokens vs Grep
Dayna Blackw · 2026-05-09 · via DEV Community

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:

  1. 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.
  2. 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.

Results

We ran 13 tasks across 4 codebases in 3 languages:

Codebase Language Lines Overall savings Tokens saved
agent-lsp Go 15K 5x ~633K
Hono TypeScript 24K 13x ~1.2M
FastAPI Python 33K 2x ~693K
HashiCorp Consul Go 319K 34x ~13.1M

The savings scale with codebase size. At 15K lines, LSP saves 5x. At 319K lines, 34x. This makes intuitive sense: grep output grows linearly with the number of files in the codebase, while LSP responses stay proportional to the number of actual references (regardless of codebase size).

The strongest results

Rename: 92-1,441x

Renaming a symbol is where the gap is most extreme.

The grep agent must:

  1. Grep the entire codebase to find all occurrences
  2. Read each matching file fully (to safely edit it without breaking things)
  3. Make the replacements
  4. Build to verify nothing broke
  5. Read the build output

The LSP agent calls rename_symbol once. It returns a structured workspace edit that atomically renames the symbol across all files. 342 bytes.

Codebase Grep bytes LSP bytes Ratio
agent-lsp (Go, 14 files) 209,589 2,285 92x
Hono (TypeScript, 24 files) 492,954 342 1,441x
FastAPI (Python, 22 files) 416,042 3,601 116x
Consul (Go, 18 files) 802,815 8,286 97x

TypeScript shows the highest ratio because typescript-language-server's rename response is extremely compact.

Precision: 92-99% of grep results are noise

This is the qualitative argument, not just a byte count.

We grepped for Close across HashiCorp Consul (319K lines). Grep returned 1,156 matches. LSP returned 12 actual references to the specific Close method we were querying.

1,144 of 1,156 grep results are false positives. They match the string "Close" in comments, other types' methods, string literals, and unrelated packages.

This is also why sed isn't a substitute for LSP rename. sed 's/Close/Shutdown/g' would modify 1,144 lines that happen to contain the text "Close" but aren't the symbol being renamed.

The precision numbers across codebases:

Codebase Grep matches LSP references False positive rate
agent-lsp 61 5 92%
Hono 15 1 93%
FastAPI 64 2 97%
Consul 1,156 12 99%

Interface implementations: 1,002-1,813x

"Find all types that implement this interface."

Grep cannot answer this question. There is no text pattern that identifies which types satisfy an interface in Go. The agent would need to read every file in the codebase, parse the method sets, and compare against the interface definition.

LSP answers in one call: go_to_implementation returns the concrete types directly.

Codebase Grep bytes LSP bytes Ratio
agent-lsp 98,221 98 1,002x
Consul 177,668 98 1,813x

98 bytes. That's the entire response: one file path and a line number.

Speculative execution: 2ms vs 1.3 seconds

"Is this edit safe? Will it break the build?"

Without LSP, the agent must:

  1. Read the file
  2. Edit the file on disk
  3. Run the build (1+ seconds)
  4. Read the build output (potentially thousands of lines)
  5. Revert the file

With agent-lsp's simulate_edit_atomic, the agent previews the edit in memory without touching disk. The response is a structured JSON with net_delta (how many new errors the edit introduces). If net_delta == 0, the edit is safe. If not, discard and try again.

No disk writes. No build. No revert. 2 milliseconds.

Multi-hop call chains: 9-12x, 87x faster

"Who calls the functions that call Shutdown?"

The grep agent must:

  1. Grep for Shutdown (find direct callers)
  2. Read each matching file to identify the enclosing function
  3. Grep for each of those enclosing functions (find indirect callers)
  4. Read context for each indirect caller

That's 25 grep calls and 585ms on a 15K-line codebase.

LSP does it in 2 calls: call_hierarchy incoming, 2 levels deep. 4.6KB, 2ms.

Why savings scale with codebase size

The fundamental asymmetry:

  • Grep cost = O(codebase size): every grep scans every file. More files = more output.
  • LSP cost = O(result size): the response contains only the matching references. More files in the codebase doesn't change the number of references to a specific symbol.

On a 15K-line codebase, grep is tolerable (small files, few matches). On a 319K-line codebase, grep becomes expensive: 5,534 calls and 17.7MB of output for a single blast-radius analysis. LSP: 119 calls and 841KB for the same information.

What the agent gets

With grep/read, the agent receives raw text it must parse, filter, and reason about. Every false positive is a distraction that costs output tokens (the agent thinks about it, decides to ignore it, moves on).

With LSP, the agent receives structured JSON. File paths, line numbers, type signatures. No parsing needed. No false positives to filter. The information is immediately actionable.

This means the real savings are even higher than the byte counts suggest. We only measure input tokens (bytes flowing into context). We don't measure the output token overhead of reasoning about noisy grep results. That cost is proportional to the noise: more false positives = more output tokens spent filtering them.

Reproduce it

The experiment is a single Go file you can point at any project:

# Go project
go run ./experiments/token-savings --root /path/to/go/project

# Python project
go run ./experiments/token-savings --root /path/to/python/project --language python

# TypeScript project
go run ./experiments/token-savings --root /path/to/ts/project/src --language typescript

Enter fullscreen mode Exit fullscreen mode

Prerequisites: gopls (Go), pyright-langserver (Python), or typescript-language-server (TypeScript) on PATH.

Source: experiments/token-savings/main.go

Full results: agent-lsp.com/token-savings

What this is

agent-lsp is an open-source MCP server that gives AI agents structured access to language servers. 53 tools, 21 agent workflows, 30 CI-verified languages. Single Go binary.

Works with Claude Code, Cursor, Windsurf, GitHub Copilot, and any MCP client.

Your agent already has grep and read. agent-lsp gives it go-to-definition, find-all-references, rename, diagnostics, completions, call hierarchy, type hierarchy, and speculative execution. Same information, fewer tokens, zero false positives.