Re: A no brainer...
| From: | Larry Garfield | Date: | Tue, 17 Oct 2006 02:43:40 +0000 |
| Subject: | Re: A no brainer... | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243231@lists.php.net to get a copy of this message | ||
On Monday 16 October 2006 14:11, Richard Lynch wrote:
> I suspect that serialization overhead is trivial for scalar data, and
> only starts to kill you when one starts schlepping bloated OOP
> structures or arrays back and forth -- at which point you messed up
> your architecture, and the serialization performance is just a
> symptom, not the disease.
Yes, serialization is trivial for scalar data. However, to use a real-world
example, the Drupal CMS allows users to define an unlimited number of path
aliases. They're just key/value mappings, one string to another. Any given
page can have dozens of links on it, which means dozens of mappings. The
database table is really just a simple two column table, user path to system
path.
In older versions, the system pulled the whole table out at once and built a
look up array, once per page. Only one query per page, but it meant a lot of
data to pull and build. On sites with lots of aliases, that got very slow.
So the latest version now pulls records one at a time. But that's a ton of
SQL queries, many of which simply find no data in the first place. So now
there's talk of building the look up table one record at a time and caching
that, but the serialization/deserialization costs there are non-trivial when
you're talking about a large array.
The balance is still being worked out. :-) I'm just pointing out that no
matter how you slice it, there is no free lunch performance-wise when you
need to store data. The right balance will depend greatly on your use case.
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson