{"id":22,"date":"2026-08-18T09:20:00","date_gmt":"2026-08-18T09:20:00","guid":{"rendered":"https:\/\/demos.canvaswp.com\/ai-coding\/2026\/08\/18\/incremental-indexing-at-repository-scale\/"},"modified":"2026-08-18T09:20:00","modified_gmt":"2026-08-18T09:20:00","slug":"incremental-indexing-at-repository-scale","status":"publish","type":"post","link":"https:\/\/demos.canvaswp.com\/ai-coding\/2026\/08\/18\/incremental-indexing-at-repository-scale\/","title":{"rendered":"Incremental Indexing at Repository Scale"},"content":{"rendered":"<p class=\"wp-block-paragraph\">A code assistant is only as useful as the picture it holds of your repository, and that picture goes stale the moment you save a file. The naive answer is to re-index on a timer. We tried it, and on a million-line monorepo it cost four minutes of CPU every ten minutes for a change that touched one function.<\/p>\n<h2 class=\"wp-block-heading\">Files are the wrong unit<\/h2>\n<p class=\"wp-block-paragraph\">Re-indexing a file is cheap. Re-resolving everything that referenced a symbol in that file is not. The index therefore stores a reverse edge for every reference, so a save invalidates a set of symbols rather than a set of files, and the set is usually small: a rename of a private helper touches its own module and nothing else.<\/p>\n<h2 class=\"wp-block-heading\">The exception that pays for the design<\/h2>\n<p class=\"wp-block-paragraph\">The exception is the widely-used interface, where one edit invalidates thousands of symbols. Those are rare enough to handle by falling back to a full pass on the affected package, and common enough that a design without a fallback would fail on the first day of real use.<\/p>\n<p class=\"wp-block-paragraph\">The result: a median save costs eleven milliseconds of index work, a package-wide interface change costs about two seconds, and the four-minute pass runs once, when you first open the repository.<\/p>","protected":false},"excerpt":{"rendered":"<p>The first index of a million-line repository takes four minutes. Every index after it follows your saves. Here is what had to be true for that to work.<\/p>\n","protected":false},"author":56,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3,4,5],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-engineering","tag-architecture","tag-indexing","tag-performance"],"_links":{"self":[{"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demos.canvaswp.com\/ai-coding\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}