PulseAugur
EN
LIVE 12:27:19

LLM code context: Comments and docstrings are the real token cost, not whitespace

Analysis of the CPython 3.13 standard library reveals that comments and docstrings constitute approximately 34.8% of tokens, making them the most significant portion of code sent to LLMs. In contrast, whitespace, such as indentation and blank lines, accounts for a much smaller percentage, with indentation saving only 2.5% when reduced. This suggests that efforts to reduce token count for LLM context windows should prioritize stripping prose over whitespace, as the latter offers minimal savings. AI

IMPACT Focusing on prose reduction in code can significantly cut LLM token costs for AI coding assistants.

RANK_REASON Analysis of code tokenization for LLMs. [lever_c_demoted from research: ic=1 ai=1.0]

Read on dev.to — LLM tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

LLM code context: Comments and docstrings are the real token cost, not whitespace

How we ranked this

Signal score
67 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
Analysis of code tokenization for LLMs. [lever_c_demoted from research: ic=1 ai=1.0]
Source corroboration
Single-source cluster
Only one publisher covered this so far. Single-source stories can still rank when the publisher is high-authority, but they lack cross-source corroboration.
Topics
infra
Editorial topic classification. Feeds into how the story surfaces on /topic/<slug> hub pages and into the per-entity coverage mix.
AI-industry relevance
High
Clearly on-topic for AI-industry coverage.
Story freshness
Breaking (< 6h)
Fresh story with cross-source coverage still developing. Ranking may shift as more sources report.

Full methodology in our editorial standards.

COVERAGE [1]

  1. dev.to — LLM tag TIER_1 English(EN) · Andrey Altrouter ·

    A third of the tokens in the code you send an LLM are comments. Indentation is 2.5%.

    <p>Sooner or later every coding-assistant project hits the same idea: the files we paste into the prompt are big, let's minify them. Collapse the indentation, delete blank lines, squeeze the whitespace like a JavaScript bundler does. It feels like the obvious win, because code lo…