Re: I wrote an extension: yajl-php
| From: | Johannes Schlüter | Date: | Wed, 09 Jan 2013 15:36:11 +0000 |
| Subject: | Re: I wrote an extension: yajl-php | ||
| References: | 1 2 3 4 5 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-10198@lists.php.net to get a copy of this message | ||
On Wed, 2013-01-09 at 18:49 +0500, Ruslan Osmanov wrote:
> > I don't have any benchmark on that level and there are many things
> > influencing this, but the internal storage for all resources is a linked
> > list, the object storage is an array.
> >
> > johannes
>
> Thanks. I'll keep going with resources then :)
Very quick test using a resource/object wrapping a single long value:
$ git clone git://github.com/johannes/resvsobj.git
$ cd resvsobj
$ phpize && ./configure && make
$ php -dmemory_limit=-1 -dextension=modules/resvsobj.so resvsobj.php 1000000 10
Creating 1000000 resources: 1.4985349178314
Calling add 10x/resource: 7.7992949485779
Freeing all (unset of array): 0.81038594245911
Creating 1000000 objects: 1.453381061554
Calling add 10x/object: 7.3565299510956
Freeing all (unset of array): 0.51739692687988
So on my machine with my PHP (debug) build objects are a tiny bit
faster. Feel free to play with the code.
johannes