When querying has() for things like patch-*, vim_starting, gui_running, etc., these were only checked after a linear scan through all ~198 entries in has_list[]. Since none of them exist in that table, the scan always came up empty before reaching the actual check.
This moves those runtime-checked features before the has_list[] scan so we skip the unnecessary work.
Called has() 1000000 times per item, averaged over 3 runs:
| feature | master | fast-path | change |
|---|---|---|---|
| patch-9.1.0001 | 6.04s | 4.84s | -19.8% |
| patch1 | 5.69s | 4.08s | -28.3% |
| vim_starting | 5.77s | 4.66s | -19.3% |
| gui_running | 5.82s | 4.36s | -25.0% |
| clipboard_working | 6.01s | 4.45s | -25.9% |
| linux | 3.99s | 4.08s | no change |
| eval | 4.37s | 4.47s | no change |
| xterm_clipboard | 6.06s | 6.27s | no change |
| writebackup | 5.74s | 5.66s | no change |
| nonexistent | 6.32s | 6.06s | no change |
| total | 55.80s | 48.93s | -12.3% |
Items that hit the fast-path are 20-28% faster. No regression for items looked up via has_list[].
https://github.com/vim/vim/pull/19550
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()