zsh-workers
 help / color / mirror / code / Atom feed
* the source of slow large for loops
@ 2011-05-07 17:00 Mikael Magnusson
  2011-05-07 19:11 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Mikael Magnusson @ 2011-05-07 17:00 UTC (permalink / raw)
  To: zsh workers

I don't know if anyone looked into why things like
for i in {1..700000}; do true; done
is extremely slow in zsh, so I did now. Turns out zhalloc is extremely
slow, and for the above loop, one particular line runs 12049901132
times according to gcov. (It takes around 10 minutes). If I add early
returns of malloc() and realloc() to zhalloc and hrealloc, the loop
runs in 3 seconds (but leaks a couple of hundred megabytes memory).

This is mostly a FYI thing, not really intending to do anything about
it or expecting anything, but I've always wondered where the slowness
was and now I know. :)

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-07 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07 17:00 the source of slow large for loops Mikael Magnusson
2011-05-07 19:11 ` Bart Schaefer
2011-05-07 19:21   ` Mikael Magnusson
2011-05-07 19:49     ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).