Re: [RFC] Switch from json extension to jsonc [Discussion]

From: Date: Thu, 29 Aug 2013 07:31:20 +0000
Subject: Re: [RFC] Switch from json extension to jsonc [Discussion]
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Le 29/08/2013 09:04, Stas Malyshev a écrit :
> Hi!
> 
>> 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
> 
> Can't we just patch the lib to do the right thing? Is it just malloc vs.
> emalloc or deeper problems?

Probably deeper problem.
Moving to statically allocated stack (just a stupid test, of course) of
json_object only reduce time by ~15%...

> 
>> 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.
> 
>> Of course I have tried to avoid this (copying the code) and prefer to
>> keep the library unchanged... but...
> 
> Well, 2x slowdown is pretty serious. I didn't have a good look at the
> code so I can't advise how to fix it, but I think it needs to be fixed
> one way or another.
> 



Thread (10 messages)

« previous php.internals (#68669) next »