On 11 June 2016 at 05:30, Bart Schaefer wrote: > This means that it has to be something that's happening in the loop > inside the n-list function, affecting every iteration. Agree > Consequently it must be one of n-list-input or n-list-draw, both of > which are declared with [the shadowed] autoload inside n-list itself. > Something about nesting calls to --zplg-reload-and-run is causing > the issue. Hmm didn't thought about that, about nesting > It might have something to do with retaining the old copy > of the function body until the call stack unwinds and it can safely > be freed; a large value for $argv would therefore also hang around > (two copies of it) for all of that time. That's apparently a hit. I attach two test files. First doesn't pass anything to sub-function: # ./aload.zsh2.txt Normal autoload: ( aload_fun_main; ) 10,91s user 0,23s system 99% cpu 11,156 total Special autoload: ( aload_fun_main; ) 9,54s user 0,23s system 99% cpu 9,792 total More special autoload: ( aload_fun_main; ) 9,15s user 0,22s system 99% cpu 9,393 total # ./aload.zsh2.txt Normal autoload: ( aload_fun_main; ) 8,85s user 0,22s system 99% cpu 9,103 total Special autoload: ( aload_fun_main; ) 8,15s user 0,23s system 99% cpu 8,405 total More special autoload: ( aload_fun_main; ) 9,36s user 0,22s system 99% cpu 9,596 total # ./aload.zsh2.txt Normal autoload: ( aload_fun_main; ) 10,22s user 0,22s system 99% cpu 10,454 total Special autoload: ( aload_fun_main; ) 9,73s user 0,22s system 99% cpu 9,971 total More special autoload: ( aload_fun_main; ) 8,02s user 0,22s system 99% cpu 8,262 total (I wonder why the varying). Second one passes long array to sub-function: # ./aload.zsh3.txt Normal autoload: ( aload_fun_main; ) 11,58s user 0,25s system 99% cpu 11,847 total Special autoload: ( aload_fun_main; ) 10,77s user 0,25s system 99% cpu 11,042 total More special autoload: ( aload_fun_main; ) 18,38s user 0,27s system 99% cpu 18,679 total # ./aload.zsh3.txt Normal autoload: ( aload_fun_main; ) 10,99s user 0,25s system 99% cpu 11,270 total Special autoload: ( aload_fun_main; ) 10,71s user 0,26s system 99% cpu 10,984 total More special autoload: ( aload_fun_main; ) 19,02s user 0,28s system 99% cpu 19,329 total > Incidentally, the way n-list is currently written, it will re-autoload > those functions and re-create all the _nlist_* helpers EVERY TIME IT > IS RUN. Mostly that's all of no net effect, but it must be slowing > down each call to n-list at least a little bit. I have a check if the function exists and don't do autoload, like the real autoload function does afaik. -- Best regards, Sebastian Gniazdowski