Mike Williams wrote:
> Never leave a developer in possession of a profiler ...
>
> So with my setup, nerdtree takes a while to start in large directory of
> files, such as VIM's src directory. On Windows the profiler shows a
> large amount of time is being spent in the CRT's isalnum(), isalpha()
> and islower() internals, coping with locale handling.
>
> Working backwards shows the calls are actually from the ASCII_IS...()
> macros in macros.h and mainly coming from get_name_len(),
> has_loop_cmd(), find_command(), etc - so from VIML processing. There is
> also a call in modifier_len() that AFAICT only has to handle ASCII as well.
>
> Since these macros enforce ASCII character range there is no need to hit
> locale handling. The simplest solution is to use a lookup table with a
> bit mask for the classifications needed. I have thrown in handling for
> VIM_ISDIGIT as well.
>
> After the patch, starting nerdtree in VIM's src is ~35% faster (1.7s vs
> 2.6s) and the CRT's locale handling functions no longer appear in the
> profile (and I warmed the file cache to remove disk reading from the
> times). In general this should help speed up longer running VIML scripts.
Yeah, we've had problems with library functions before.
I think using a table is often slower than simple compares, because a
table lookup has to access memory, while a compare is local inside the
CPU. Especially for ASCII_ISLOWER and ASCII_ISUPPER, it's just two
compares. Changing VIM_ISDIGIT() this way is likely to make it slower.
ASCII_ISALNUM() requires six compares, perhaps a table is faster then?
--
hundred-and-one symptoms of being an internet addict:
163. You go outside for the fresh air (at -30 degrees) but open the
window first to hear new mail arrive.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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].
For more options, visit https://groups.google.com/groups/opt_out.