Christian wrote: > Bram, > here is patch, that will switch from the NFA engine to the BT regular > expression engine when there are too many states encountered. I have > tested it on some input on which the NFA engine was slow (issue #164) > and it worked. I made it so, that when verbose is set, Vim outputs > whenever it switches the engines. This will however only be done, when > 're' is set to 0 > > I am however not sure, what a good measure is, when to abort the NFA > engine and switch to the old engine, but that could easily be switched.
Interesting idea. I think the limit on the number of states is just a first guess. Some states are cheap (e.g. matching one specific character), some are expensive (e.g. when doing recursive stuff). At some point this can be tuned. Please move the decision to one central function. Some things in the BT engine are also expensive, such as two multis in a row: ".*a*". There are many alternatives to try then. I consider this a start to make the choice of engine more clever. We also need some kind of benchmark to be able to tune the choice. -- How do I set the laser printer to stun? /// 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/d/optout.
