Hi, On Sun, Jun 7, 2020 at 2:30 AM lacygoill <[email protected]> wrote:
> @yegappan <https://github.com/yegappan> Thank you for working on this > feature. > > The more entries a quickfix list contains, the more costly the > 'quickfixtextfunc' seems to be. > > I tried to write what seems to be a simple function: > > And tested it with this command: > > $ vim -Nu NONE -S <(curl -Ls > https://gist.githubusercontent.com/lacygoill/57d3cd8b5313159f42af43704ebfa7a8/raw/a255cbc37efe18319690943129d0abdf661c1434/profile_quickfixtextfunc.vim) > > :QfTf 8 > > > On my machine, the test took about 2 minutes to complete. Here are the > results: > > 1000 entries: 0.001 seconds to run :copen > > 0.039 seconds to run :copen with 'qftf' 39 times slower > > 2000 entries: 0.001 seconds to run :copen > > 0.084 seconds to run :copen with 'qftf' 84 times slower > > 4000 entries: 0.003 seconds to run :copen > > 0.190 seconds to run :copen with 'qftf' 63 times slower > > 8000 entries: 0.006 seconds to run :copen > > 0.457 seconds to run :copen with 'qftf' 76 times slower > > 16000 entries: 0.012 seconds to run :copen > > 1.260 seconds to run :copen with 'qftf' 105 times slower > > 32000 entries: 0.025 seconds to run :copen > > 4.983 seconds to run :copen with 'qftf' 199 times slower > > 64000 entries: 0.054 seconds to run :copen > > 23.322 seconds to run :copen with 'qftf' 431 times slower > > 128000 entries: 0.107 seconds to run :copen > > 97.002 seconds to run :copen with 'qftf' 906 times slower > > > As you can see, for a quickfix list with more than a thousand entries, > 'quickfixtextfunc' makes :copen around a thousand times slower. And the > more entries, the slower the feature is. > > Do you think something could be done to prevent the function from being > called when the quickfix list contains too many entries? Maybe the option > could be set to a colon separated list of values: the name of the function > to format the entry in the quickfix window, and an optional number. When > the size of a quickfix list goes beyond that number, the function would not > be invoked to format the entry. It would be displayed as if the option was > not set. > To address this scalability problem, I have created following PR: https://github.com/vim/vim/pull/6234 Instead of calling the 'quickfixtextfunc' for each entry in the quickfix list, now it will be called for multiple entries (start_idx to end_idx). Now your test runs much faster. If entries are added to the quickfix list one at a time, then this will not help. For example, if a plugin asynchronously runs a command and adds the lines from the command output one at a time to the quickfix list, then the overhead of calling the 'quickfixtextfunc' function cannot be avoided. This overhead can be reduced if the plugin accumulates multiple lines and then add it to the quickfix list. - 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/CAAW7x7ktCxxL%3DRCKE7Oa0B%2BUrPgKT2mdcz-v8W3HVgyWVsjkvA%40mail.gmail.com.
