[vim/vim] f_has(): fast-path for features not in has_list[] (PR #19550)

5 views
Skip to first unread message

mattn

unread,
6:48 AM (14 hours ago) 6:48 AM
to vim/vim, Subscribed

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[].


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19550

Commit Summary

  • 06b84ef f_has(): fast-path for features not in has_list[]

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19550@github.com>

Christian Brabandt

unread,
3:41 PM (5 hours ago) 3:41 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19550)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19550/c3986799619@github.com>

Christian Brabandt

unread,
3:48 PM (5 hours ago) 3:48 PM
to vim/vim, Subscribed

Closed #19550 via 327e0e3.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19550/issue_event/23205424713@github.com>

Reply all
Reply to author
Forward
0 new messages