Le 29/08/2013 08:25, Stas Malyshev a écrit :
> Hi!
> 
>> Subject: Switch from json extension which have a problematic (non-free)
>> license  to jsonc dropin free alternative.
>>
>> RFC: https://wiki.php.net/rfc/free-json-parser
> 
>>From what I see in the benchmarks, while encoding is on par with current
> implementation, decoding is more than 2x slower. This may be a problem,
> especially for something like REST API that may have to decode decent
> amount of JSON data. Can it be fixed?

>From my analysis (profiling), most of the time is spent in memory
allocation calls.

As we used a parser from a library, we do
1- parse in library space
2- object tree allocation of the result
3- copy result from library space to php space
4- PHP object tree allocation

I don't see any good solution to optimize this except copying the code
from the library into PHP, and thus remove stop 2+3.

> 
> Also, I see the sizes of the encode results is different from ext/json.
> Why is that?
> 
> Also, "Partial implementation of big integers parsing" is a bit
> worrying. If we want to have drop-in replacement, partial
> implementations would lead to trouble. Can it be fixed?

As the parsing is done in the library, we receive a int64. So to late.
As previously copying the code will allow such change.

Of course I have tried to avoid this (copying the code) and prefer to
keep the library unchanged... but...


Remi.



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to