On Oct 18, 2015 1:40 PM, "Sebastian Gniazdowski" wrote: > > On 18 October 2015 at 18:19, Bart Schaefer wrote: > > > > I'm strongly inclined to think that's more likely an artifact of the > > testing method than of the test itself have you tried running the > > tests in the opposite order? > > It starts new zsh process – the one in "$current_zsh" variable – and > feeds it with the same script file, giving in arguments pid of main > Zsh, name of tested Zsh and name of test function to run. This should > imply full separation of the tests. That's why order shouldn't matter. Sorry, I didn't mean order of zsh versions, I meant did you try doing array_test before string_test within each version. > You are quite right that the memory usage isn't "high from the > beginning". It starts from 41 MB, goes to 164, 279, etc. in quite > controlled way. Previous version of the script awaited 3 seconds > before doing first check, that's why it started from values of 100 MB, > and I rather misinterpreted this. How to interpret these still high > values is now open. 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. > Tried a new test function: > > Its memory usage is low for all Zsh versions: ~2.5 MB, (e.g. 2.7, 2.9, > 2.8, 2.6, 2.9, 2.8, 2.6, 2.9, 2.9, 2.8). For functions the test would also need to compare run time / CPU usage - I would not expect memory usage to be interesting unless the function declared locals.