Skip to content

perf(startup): defer implementation modules - #435

Merged
barrettruth merged 2 commits into
mainfrom
perf/lazy-bootstrap
Sep 21, 2026
Merged

barrettruth merged 2 commits into
mainfrom
perf/lazy-bootstrap

Conversation

@barrettruth

@barrettruth barrettruth commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #125 and the startup-time concern raised there.

Problem

The plugin bootstrap loads 29 of 38 Lua modules before a user invokes a feature. BufReadPost also initializes runtime support for ordinary files.

Before/After Profiling

main before and after the change:

Scenario main median PR median Change
Native plugin source 6.285 ms 0.472 ms -92.5%
Warm lazy.nvim startup 8.031 ms 4.459 ms -44.5%
Open an ordinary 100,000-line file 18.370 ms 11.195 ms -39.1%
Startup modules 29 2 -27
Retained Lua heap 500.2 KiB 44.7 KiB -91.1%

The first relevant git file type moves from 8.365 ms to 9.875 ms. This 1.510 ms cost occurs when the feature is first needed.

For a 100,000-line buffer with a marker at the end, native marker search takes 2.985 ms. Copying and scanning the buffer in Lua takes 6.698 ms.

barrettruth and others added 2 commits September 21, 2026 10:45
Keep configuration validation and entry-point registration eager. Load commands, runtime, and integrations only when their entry points run. Screen ordinary files for conflict markers before loading conflict support.
@barrettruth
barrettruth merged commit f85d1ab into main Sep 21, 2026
5 checks passed
@barrettruth
barrettruth deleted the perf/lazy-bootstrap branch September 21, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant