<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Startuptime - 标签 - William</title>
    <link>https://williamlfang.github.io/tags/startuptime/</link>
    <description>Startuptime - 标签 | William</description>
    <generator>Hugo -- gohugo.io</generator><language>zh-CN</language><lastBuildDate>Sat, 03 Oct 2026 00:08:03 &#43;0900</lastBuildDate><atom:link href="https://williamlfang.github.io/tags/startuptime/" rel="self" type="application/rss+xml" /><item>
  <title>Profiling Neovim startup: lazy-loaded plugins that weren&#39;t lazy</title>
  <link>https://williamlfang.github.io/2026-10-03-nvim-startup-lazy-loading/</link>
  <pubDate>Sat, 03 Oct 2026 00:08:03 &#43;0900</pubDate>
  <author>william</author>
  <guid>https://williamlfang.github.io/2026-10-03-nvim-startup-lazy-loading/</guid>
  <description><![CDATA[<div class="featured-image"><img loading="eager" src="https://williamlfang.github.io/2026-10-03-nvim-startup-lazy-loading/featured-image.png" alt="Profiling Neovim startup: lazy-loaded plugins that weren&#39;t lazy" title="Profiling Neovim startup: lazy-loaded plugins that weren&#39;t lazy" referrerpolicy="no-referrer"/></div><blockquote>
<p><strong>Update 2026-10-17:</strong> the next pass looked at big log files, and found an
<code>nc</code> mapping that made every <code>n</code> wait <code>timeoutlen</code> (500 ms) in every file. See
<a href="/2026-10-17-nvim-big-log-files/">Profiling Neovim on big logs</a>.</p>
</blockquote>
<p>After <a href="/2026-10-02-tmux-lag-round-2/">tmux</a> and
<a href="/2026-10-02-zsh-startup-and-command-lag/">zsh</a>, I looked at
Neovim. My config has grown to 138 plugins on lazy.nvim and LazyVim. Almost
every spec has an <code>event</code>, <code>cmd</code> or <code>keys</code>, so I assumed most of them were lazy.
They weren&rsquo;t: <strong>89 of the 138 plugins loaded at startup</strong>.</p>
<p>None of the causes was a slow plugin. They were config mistakes that only show
up once you ask lazy.nvim <em>why</em> each plugin loaded. I fixed them in two rounds:</p>
<table>
<thead>
<tr>
<th></th>
<th style="text-align:right">before</th>
<th style="text-align:right">after</th>
</tr>
</thead>
<tbody>
<tr>
<td>CPU time to first screen, opening a new file</td>
<td style="text-align:right">~150 ms</td>
<td style="text-align:right"><strong>~120 ms</strong></td>
</tr>
<tr>
<td>CPU time to first screen, no file (dashboard)</td>
<td style="text-align:right">69 ms</td>
<td style="text-align:right"><strong>50 ms</strong></td>
</tr>
<tr>
<td>plugins loaded at startup</td>
<td style="text-align:right">89</td>
<td style="text-align:right"><strong>73</strong></td>
</tr>
</tbody>
</table>]]></description>
</item>
</channel>
</rss>
