Skip to content

Performance: Vim vs VS Code

Numbers don't lie. Here's why this setup feels instant.

Startup Time

Editor Cold Start Warm Start
dotvim ~80ms ~40ms
VS Code ~3000ms ~1500ms
IntelliJ ~8000ms ~4000ms
Neovim (LazyVim) ~120ms ~60ms

Measure yourself:

# Vim startup time
vim --startuptime /tmp/vim-startup.log +qa && tail -1 /tmp/vim-startup.log

# VS Code (rough: time from launch to responsive)
time code --wait --new-window /dev/null

Memory Usage

Editor Idle 10 files open Large file (50MB)
dotvim ~30MB ~45MB ~80MB
VS Code ~350MB ~550MB Crashes or 1.2GB
IntelliJ ~800MB ~1.2GB 2GB+

Why It's Fast

1. No Electron

VS Code runs Chromium (a full browser engine) to render text. That's 300MB before you type a character. Vim renders directly to your terminal emulator.

2. Async Everything

Operation dotvim VS Code
Completion Async (never blocks) Async
Diagnostics Async (vim-lsp) Async
File search fzf (C, blazing fast) ripgrep (same, but wrapped in Electron)
Git gutter Async (gitgutter) Async
Build Async (asyncrun) Async (task runner)

Both are async, but Vim's event loop is native C, not JavaScript.

3. Lazy Loading

" These plugins don't load until you use them:
Plug 'preservim/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' }
Plug 'voldikss/vim-floaterm', { 'on': ['FloatermToggle', 'FloatermNew'] }

If you never open the file explorer in a session, it never loads. VS Code loads all extensions at startup.

4. No Telemetry, No Updates, No Background Processes

VS Code runs: - Extension host (separate process) - TypeScript server - Git integration service - Telemetry reporter - Update checker - Marketplace API calls

Vim runs: vim. That's it.

5. Regex Engine Selection

set regexpengine=1  " Older, faster engine for syntax highlighting

Vim's newer regex engine (NFA) is more correct but slower for syntax. The old engine handles 99% of highlighting cases faster.

What VS Code Does Better (Honestly)

Feature VS Code Advantage
Visual debugging Breakpoints, watch variables, call stack UI
Extension marketplace One-click install, ratings, millions of extensions
Remote containers Dev Containers with Docker integration
Jupyter notebooks Native cell execution
Settings UI GUI for configuration
Live Share Real-time collaboration
First-time UX Works out of the box, no learning curve

What Vim Does Better

Feature Vim Advantage
Startup speed 40ms vs 3000ms
Memory 30MB vs 350MB
Large files Handles 100MB+ without blinking
Remote editing SSH + vim = full IDE, zero latency
Batch editing Macros + :g = unlimited power
Customization depth Every single behavior is configurable
Stability No random "Extension host terminated" crashes
Terminal integration IS the terminal
Resource usage Runs on a 512MB VPS, Raspberry Pi, embedded boards
Longevity Your config works in 10 years. VS Code extensions break monthly

Performance Tips for This Config

If Vim feels slow, check:

" Profile startup
vim --startuptime /tmp/profile.log
" Sort by time:
sort -t: -k2 -n /tmp/profile.log | tail -20

" Profile a slow operation
:profile start /tmp/vim-profile.log
:profile func *
:profile file *
" ... do the slow thing ...
:profile stop

Common culprits:

Issue Fix
Slow syntax on large files :set synmaxcol=200 limits highlight columns
LSP slow on huge projects Add .lsp-settings.json to limit workspace scope
Slow startup Check :PlugStatus for failing plugins
Sluggish scrolling Virtual text is disabled (lsp_diagnostics_virtual_text_enabled = 0)
clang-format hangs Auto-format disabled for files > 10k lines

Plugin Weight Analysis

After profiling, here's the load-time breakdown for each plugin category:

Plugin Load Time Justification Can Remove?
vim-lsp + asyncomplete ~15ms Core: code intelligence No
fzf + fzf.vim ~10ms Core: file navigation No
vim-polyglot ~25-30ms Syntax for all languages Consider: LSP covers most
vim-airline ~8ms Statusline Consider: lightline is faster
vim-gitgutter ~5ms Git diff signs No
vim-fugitive ~3ms Git commands No
NERDTree 0ms (lazy) File explorer No (already lazy)
vim-easymotion ~5ms Motion shortcuts Now lazy-loaded
4x colorschemes ~5ms each Themes Now only active one loads
indentLine ~3ms Indent guides Consider: can use listchars
vim-devicons ~3ms File icons Nice-to-have, not critical

Optimizations Applied

  1. Colorschemes: Only the active theme loads (~15ms saved)
  2. vim-easymotion: Lazy-loaded on first use (~5ms saved)
  3. vim-visual-multi: Removed (complex, rarely used in modal editing)
  4. LSP semantic/inlay hints: Disabled by default (~20ms per buffer saved)
  5. vim-polyglot: sensible pack disabled (loaded separately via tpope/vim-sensible)

Total estimated savings: ~35-50ms (from ~80ms → ~40ms cold start).

Future Considerations

Change Savings Tradeoff
Replace vim-airline with lightline ~5ms Less out-of-box features
Remove vim-polyglot entirely ~25ms Lose syntax for non-LSP filetypes
Replace indentLine with listchars ~3ms Less visual polish
Remove vim-devicons ~3ms No file type icons