I was doing some testing with some cache files we use and found some shocking memory usage with big arrays. Basically, when creating a large array in a verbose manner using $CATEGORIES[2]["name"] = "foo"; syntax, the memory usage was much higher than other methods. For the particular file I was using, it was 5MB (verbose code) vs. 1.1MB (var_export format) vs. 900k (serialized).

All my test code is at http://dev.phorum.org/bigarray.tar.gz and more details are in my blog post at http://doughboy.wordpress.com/2007/02/26/big-arrays-in-php/.

I didn't want to post this to the bug list as I don't know that it is a bug. This may be expected behavior. But, I figured it would not hurt to point it out. Maybe something obvious can be done to fix this? I am not an advanced C coder or I would dig in to the code myself.

--

Brian Moon
-------------
http://dealnews.com/
It's good to be cheap =)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to