Re: [PHP4BETA] Serialization efficiency
| From: | Zeev Suraski | Date: | Sat, 12 Jun 1999 12:25:34 +0000 |
| Subject: | Re: [PHP4BETA] Serialization efficiency | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-1529@lists.php.net to get a copy of this message | ||
On Sat, 12 Jun 1999, Sascha Schumann wrote:
> Binary format for IS_LONG and IS_DOUBLE? Is that meant serious?
Very.
> A long here needs 8 bytes to be stored completely (uncompressed).
That's on a 64-bit platform. Same goes for a double precision number
which gives us the size of our union anyway, so yes, we're talking 8
bytes.
> If you don't use scientific large numbers within your PHP
> application, this will grow the size needed for storing numbers
> since the ASCII representation is usually much shorter.
So? 'Size does not matter'. Reading a hundred bytes and reading 50 bytes
takes the same time. Having to call functions like sprintf(), str*(),
ato*() and strto*() takes much, much more time and logic.
Basically, the fact that you'd have one fwrite() call and one fread() call
to serialize simple pval's (plus trivial logic to serialize strings and
complex pvals) far exceeds the disadvantage of having slightly bigger
data. Besides, looking at the current implementation of the text based
serialization, it does appear that the last thing the author was trying to
do was writing in a compact format. I'm not saying that as a bad thing
(since the obvious goal was to write something that's easy for a human to
read), but I think that saying it's more efficient is rediculous.
Zeev
--
-----------------------------------------------------
Zeev Suraski <zeev@zend.com>
For a PGP public key, finger bourbon@netvision.net.il