Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Optimizing (z)-flag

I'm thinking: why the (z) flag runs significantly slower that a zsh
executing the same script / text? It points that the cause should be
the way that (z) stores resulting elements. I suspect that it in
general doesn't use realloc() to extend the destination array but
instead some kind of allocate new larger buffer / copy / free the
previous buffer. So the possible optimization could be to use realloc,
a method that has already been proven, as it is used when appending to

Am I right? Where is the code of (z) flag aggregating the resulting
elements located? It's hard to find as it's somewhere between the
lex.c and subst.c.

The advantages of providing such optimization would span over e.g.
syntax-highlighting plugins.
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

Messages sorted by: Reverse Date, Date, Thread, Author