You can also also view the full archives of micro-posts. Longer blog posts are available in the Articles section.
Yatoro: VIM-like Apple Music Player in Terminal. #apple
#unix
TIL about macOS / binaries, to look up macOS binaries lying all around System Monitor. #apple
Still wasting time looking at possible micro-optimizations on the CLI side. The MacBook M4 Pro is a beast, and I found it reduced by a fair amount (~ 40%) Neovim startup time. Digging into how fast it starts now (using vim-startuptime and hyperfine), I found the following:
scratch master* 2m44s
» hyperfine "nvim --headless +qa" --warmup 5
Benchmark 1: nvim --headless +qa
Time (mean ± σ): 32.5 ms ± 0.4 ms [User: 19.0 ms, System: 7.1 ms]
Range (min … max): 31.4 ms … 33.7 ms 85 runs
scratch master*
» vim-startuptime --vimpath nvim
Extra options: []
Measured: 10 times
Total Average: 22.782900 msec
Total Max: 28.338000 msec
Total Min: 21.359000 msec
AVERAGE MAX MIN
------------------------------
14.312000 18.240000 13.348000: /Users/chl/.config/nvim/init.lua
5.226100 6.687000 4.827000: require('fzf-lua')
2.576100 3.206000 2.425000: require('nvim-treesitter.configs')
2.393600 2.972000 2.255000: require('nvim-treesitter.query')
2.110400 2.705000 1.979000: require('vim.lsp')
1.709600 2.168000 1.511000: require('fzf-lua.config')
1.443200 1.824000 1.330000: require('fzf-lua.path')
1.227300 1.388000 1.181000: loading rtp plugins
1.133800 1.385000 1.052000: require('nvim-treesitter.tsrange')
1.064300 1.333000 1.004000: require('nvim-treesitter.compat')
1.053900 1.290000 0.977000: require('nvim-treesitter.ts_utils')
1.016600 1.270000 0.961000: require('vim.treesitter')
0.990800 1.184000 0.943000: /Users/chl/.config/nvim/plugin/lisp.lua
0.973200 1.165000 0.927000: nvim_exec2() called at /Users/chl/.config/nvim/plugin/lisp.lua:0
The lisp.lua
custom plugin is just here to load slimv which sits as an optional plugin, and so I realized that there was no gain in this case. Better to leave it as a start plugin and remove the custom plugin itself. It makes no difference whatsoever. It’s still much higher than three years ago when I was using a proper package manager and much less Lua code in my init.lua
. However, I found that using vim.loader.enable()
introduced in Neovim 0.9 resulted in a slight improvement:
~/.config/nvim
» hyperfine "nvim --headless +qa" --warmup 5
Benchmark 1: nvim --headless +qa
Time (mean ± σ): 25.7 ms ± 0.5 ms [User: 12.8 ms, System: 6.7 ms]
Range (min … max): 24.3 ms … 26.9 ms 112 runs
Loading my init.lua
is now two times faster as reported by vim-startuptime. #vim
I spent some time figuring out why my Zsh startup time became so slow over time. Initially I thought about compinit
, and I added this fix mentioned everywhere on the internet (read zcompdump
once per day):
# autoload -U compinit && compinit
autoload -Uz compinit
if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.config/zsh/.zcompdump) ]; then
compinit
else
compinit -C
fi
This helped, but the real culprint was NVM which considerably slows down Zsh startup with its loading script nvm.sh
. I use the following trick. In retrospect, compinit
isn’t accounting for that much time when checked agaisnt zprof
, but Zsh now starts like a breeze again:
~/.config/zsh
» time zsh -i -c exit
Saving session...completed.
zsh -i -c exit 0,03s user 0,03s system 90% cpu 0,073 total
Nowadays, Apple includes the system upgrades in the upfront cost of its computers, so the incentive to constantly roll out ten or twenty or three hundred “new features” should be lower. Inexplicably, since the company adopted that no extra charge, yearly release cadence, it has seemingly been more reticent to do a disciplined “Snow” release, no matter how necessary. — Apple Needs a Snow Sequoia
/me is listening to “Salute Your Solution” by The Raconteurs
Cool Python Functions. I already came across this post a while ago, but it’s interesting to read or reread, especially on how to iterate backward or how to merge two dictionnaries. #python
/me is listening to “Unsent” by Minuit Macine
I don’t even know what to think about this, but it was interesting to read: Solving LeetCode™ problems with Racket. #racket
Algorithms for making interesting organic simulations: Lot of interesting stuff, which reminds me of Anders Hoff’s work at https://inconvergent.net.