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

Re: Slowdown around 5.0.5-dev-0



On Oct 18, 11:31pm, Sebastian Gniazdowski wrote:
}
} > String is stored as one contiguous block of bytes, so each time it exceeds
} > the size of the current heap block an entire new large-enough block is
} > allocated, and no previous block can never be re-used because the string
} > never shrinks.
} 
} How can 5.1.1-dev-0 with no patches maintain low memory usage for
} strings then?

It's probably this:

+               h->next = NULL;
+           } else {
+               /* Leave an empty arena at the end until popped */
+               h->used = 0;
+               fheap = hl = h;
+               break;
+           }
+           if (fheap == h)

We leave that empty arena at the end, but then on the next zhalloc()
it's still not big enough, so another one gets allocated.

You could try removing that "else" to let the trailing block be freed
again, but then we're back to needing to compare speed as well as space
across shell versions.



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