Re: Re: unserialize() bottle-neck

From: Date: Wed, 12 Jan 2005 23:10:14 +0000
Subject: Re: Re: unserialize() bottle-neck
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35476@lists.php.net to get a copy of this message
Wez Furlong wrote:
I found it much faster to spit out an array declaration and then use eval() to pull that data back in. I had about 500kb of data.
I don't exactly get what you said there... Like : $serialized = 'array(' . implode(',',$my_array) . ');'; And then : $unserialized = eval($serialized); ? Anyway, that kind of stuff wouldn't work very well in my case. Check the array structure XML_Indexing uses for storing index. It is far from a 2D thing. The following example is an index for all occurences of RDF:Description tags which contain a 'test' attribute, in a 2.5 Mb RDF file. Each of these occurences consists in a couple : the XML region offset (as used when calling fseek()) and its length. (sorry for so much pasting, but that is a real example) Array (
    [/RDF:RDF/RDF:Description] => Array
        (
            [test] => Array
                (
                    [1] => Array
                        (
                            [0] => Array
                                (
                                    [0] => 30130
                                    [1] => 568
                                )
                            [1] => Array
                                (
                                    [0] => 34725
                                    [1] => 556
                                )
                            [2] => Array
                                (
                                    [0] => 392786
                                    [1] => 568
                                )
                            [3] => Array
                                (
                                    [0] => 397381
                                    [1] => 556
                                )
                            [4] => Array
                                (
                                    [0] => 755442
                                    [1] => 568
                                )
                            [5] => Array
                                (
                                    [0] => 760037
                                    [1] => 556
                                )
                            [6] => Array
                                (
                                    [0] => 1118098
                                    [1] => 568
                                )
                            [7] => Array
                                (
                                    [0] => 1122693
                                    [1] => 556
                                )
                            [8] => Array
                                (
                                    [0] => 1480754
                                    [1] => 568
                                )
                            [9] => Array
                                (
                                    [0] => 1485349
                                    [1] => 556
                                )
                            [10] => Array
                                (
                                    [0] => 1843410
                                    [1] => 568
                                )
                            [11] => Array
                                (
                                    [0] => 1848005
                                    [1] => 556
                                )
                            [12] => Array
                                (
                                    [0] => 2206066
                                    [1] => 568
                                )
                            [13] => Array
                                (
                                    [0] => 2210661
                                    [1] => 556
                                )
                        )
                    [2] => Array
                        (
                            [0] => Array
                                (
                                    [0] => 36337
                                    [1] => 663
                                )
                            [1] => Array
                                (
                                    [0] => 398993
                                    [1] => 663
                                )
                            [2] => Array
                                (
                                    [0] => 761649
                                    [1] => 663
                                )
                            [3] => Array
                                (
                                    [0] => 1124305
                                    [1] => 663
                                )
                            [4] => Array
                                (
                                    [0] => 1486961
                                    [1] => 663
                                )
                            [5] => Array
                                (
                                    [0] => 1849617
                                    [1] => 663
                                )
                            [6] => Array
                                (
                                    [0] => 2212273
                                    [1] => 663
                                )
                        )
                )
        )
    [NS] => Array
        (
            [NC] => http://home.netscape.com/NC-rdf#
            [RDF] => http://www.w3.org/1999/02/22-rdf-syntax-ns#
        )
) -- og

« previous php.pear.dev (#35476) next »