Bram Moolenaar <[email protected]> wrote:

>
> Ron Aaron wrote:
>
>> I'm sure there's a reason, but I wonder:
>>
>> why, in regexp_nfa.c "nfa_recognize_char_class()", is the "config"
>> using chars instead of integer bitmaps?  I would expect bitmaps to be
>> faster (as well as taking less space).
>
> Yeah, one of the things that still needs to be improved.
> When using an int it could just use switch instead of looping to find
> the match in config[].
>
> Also note that it's put on the stack, it should be static.
> If needed at all, possibly using #define.
>
> So, if someone wants to work on this, please write a test, verify that
> the test passes, then change to code to a more efficient version.


Please check the attached patch which improves
function nfa_recognize_char_class() as it was suggested.

I also extended test36 to:

- test with regexpengine values 0, 1, 2 (instead of just 0)
- test \d and [0-9], \D and [^0-9] (etc) instead of just \d, \D (etc)
  in order to make sure we exercise all cases in
  function nfa_recognize_char_class().

Patch also fixes 2 unrelated typos in comments.

I don't think that nfa_recognize_char_class() was
a bottleneck so I don't expect significant speed up
but I'd love to be proven wrong :-)

Regards
Dominique

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


Attachment: improved-nfa_recognize_char_class-7.3.1109.patch
Description: Binary data

Raspunde prin e-mail lui