Hi Bram,

On Wed, Jan 19, 2022 at 4:34 AM Bram Moolenaar <[email protected]>
wrote:

> I'm not sure this is an improvement. Using a switch statement the compiler
> can find the optimal way to select the code to execute. A linear search
> through an array is likely to always be slower.
> A binary search would be much better, but it is hard to get the key codes
> in sorted order.
> A kind of hashtable might also work. It would have to be created at
> runtime though.
>
> We have a similar problem for the normal mode command, which is using a
> sorted index table. It is filled in init_normal_cmds().
> This adds to the startup time.
>
> We could change this to generate the table at compile time. Then the table
> used for "g" commands could also use a binary search, like in
> find_command(). The "g" command table would have gaps in the lower block
> (the part where the typed character can directly be used as an index, up to
> "~"). Or not use a lower block.
>
>
>
I will rework the patch to use a binary search to lookup the function for a
given key.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7ncrhFr-E0Sp0qRiWKZU9%3Diox58Xq7LUrNO%2BRoc2nzpoA%40mail.gmail.com.

Raspunde prin e-mail lui