<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>LazyVim - 标签 - William</title>
    <link>https://williamlfang.github.io/tags/lazyvim/</link>
    <description>LazyVim - 标签 | William</description>
    <generator>Hugo -- gohugo.io</generator><language>zh-CN</language><lastBuildDate>Sat, 17 Oct 2026 12:00:00 &#43;0900</lastBuildDate><atom:link href="https://williamlfang.github.io/tags/lazyvim/" rel="self" type="application/rss+xml" /><item>
  <title>Profiling Neovim on big logs: a growing 87 MB log froze the UI 11 s out of every 15</title>
  <link>https://williamlfang.github.io/2026-10-17-nvim-big-log-files/</link>
  <pubDate>Sat, 17 Oct 2026 12:00:00 &#43;0900</pubDate>
  <author>william</author>
  <guid>https://williamlfang.github.io/2026-10-17-nvim-big-log-files/</guid>
  <description><![CDATA[<div class="featured-image"><img loading="eager" src="https://williamlfang.github.io/2026-10-17-nvim-big-log-files/featured-image.png" alt="Profiling Neovim on big logs: a growing 87 MB log froze the UI 11 s out of every 15" title="Profiling Neovim on big logs: a growing 87 MB log froze the UI 11 s out of every 15" referrerpolicy="no-referrer"/></div><p>After the <a href="/2026-10-03-nvim-startup-lazy-loading/">startup pass</a>,
the slowest thing left in my Neovim was big log files. <code>~/log</code> holds logs from
0.5 MB to 136 MB. The one I read most is 87 MB: 176,939 lines of about 500
characters, growing by about 2 lines a second while I read it. Opening it took
1.9 s before Neovim accepted a key. <code>n</code>, <code>/</code>, typing and <code>&lt;Esc&gt;</code> each stalled.
Just reading the log while it grew <strong>froze the UI for about 11 of every 15
seconds</strong>.</p>
<p>No single plugin was to blame. Several separate pieces of work grew with the
file, and one key mapping slowed <code>n</code> in every file. Medians of 5 runs in a
real terminal:</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>open the 87 MB log until keys are accepted</td>
<td style="text-align:right">1857 ms</td>
<td style="text-align:right"><strong>199 ms</strong></td>
</tr>
<tr>
<td><code>n</code></td>
<td style="text-align:right">523 ms</td>
<td style="text-align:right"><strong>21 ms</strong></td>
</tr>
<tr>
<td>UI blocked per 15 s while reading the growing log</td>
<td style="text-align:right">10963 ms</td>
<td style="text-align:right"><strong>0 ms</strong></td>
</tr>
</tbody>
</table>]]></description>
</item>
<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>
