serialize() is slow
| From: | Wez Furlong | Date: | Fri, 26 Mar 2004 14:38:26 +0000 |
| Subject: | serialize() is slow | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-8773@lists.php.net to get a copy of this message | ||
I don't normally go in for big arrays in PHP, but I've had the
"opportunity" to write a script that grabs a couple of thousand rows
from a database, each row having ~120 small fields, and serialize it
for consumption elsewhere.
I didn't benchmark it, but it takes a good few seconds to serialize.
I can write my own serialization function in native php using foreach()
and addcslashes etc. and have it run in ~1 second. That probably means
that serialize() should be able to run in less time than that.
Would one of the performance gurus mind taking a look at serialize?
My gut feeling is that there are a lot of reallocs() going on, so
it might simply be solved by setting a bigger chunk size (smart_str
stuff).
--Wez.