Hi, I've observed a poor performances issue when using glob(starstar/whatever). I know this is a known issue, I just had to look at the first lines of unix_expandpath().
And yet, we could do better. Much better. I've run a simple test case in callgrind: > valgrind --tool=callgrind ./vim -U NONE -u NONE -c "echo > glob('~/.vim/**/tags')" -c q On my current machine, I see vim_regexec() and vim_regcomp() executed 14036 times, and taking respectively 41.72% + 15.67% of unix_expandpath() (lr) cycles measured by callgrind. Investigating further, I've seen that simply by caching `regmatch.regprog` when `starstar` is true and `e-s==2`, vim_regcomp() is executed now only **once** on my test case. From 363879003 cycles in unix_expandpath() I do down to 291294681. This looks like a good start. static regprog_T *reg_starstar = NULL; if (!reg_starstar) { reg_starstar = reg_starstar_compute(); } ... if (starstar && (e-s == 2)) { onlystarstar = TRUE; regmatch.regprog = reg_starstar; if (regmatch.regprog == NULL) { vim_free(buf); return 0; } } else { old code, rearranged, of course } And I wonder. Do we really need to apply regmatch when we know we are in a "starstar" situation? Can't we simply go down to the next sub-directory? BTW, on another topic, I've also executed > vim -U NONE -u NONE -c "echo glob('~/.vim/**5/tags')" -c q which yields no result on v 8.0.502, un-patched, and on my patched v8.0.563 If I understand the documentation correctly, this looks like a bug. -- Luc Hermitte -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.