« Embarassing newbie coder bug | Main | Echo is running much faster now »

The irony of having to optimize echo

/bin/echo is running too slowly! echo does close to nothing in terms of memory management, this is bad for the mullocator, because I allocate currently about 70 VM pages waiting for the onslaught of malloc calls. As these pages are actually touched, this means that the kernel is zerofilling 280 MB, which does take a perceptible amount of time, in the end echo allocates like this (the + means malloc)
+ 40 
+ 44
+ 8
+ 72
+ 40
+ 40
+ 40
+ 131072 (131072) 
Painfully enough, I can't satisfy the 32 pages request with my already allocated pages, because it is too large (I reserve the 70 pages or so for smaller requests), which means more zerofilling.. I have no idea, why /bin/echo allocates 131072 bytes. Might be fun to look into Darwin for that.

About

This page contains a single entry from the blog posted on June 30, 2003 11:17 PM.

The previous post in this blog was Embarassing newbie coder bug.

The next post in this blog is Echo is running much faster now.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 4.25