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. > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php