Hello,
I have written a JSON Parser / Evaluator. I wanted to make it faster by using Alchemy. Here's the result...
/********************************************************************* ***********************************************/
var loader:CLibInit = new CLibInit;
var lib:Object = loader.init();
lib.init(E);
/********************************************************************* ***********************************************/
var z:int = 0;
var t:Number, i:String;
t = new Date().time;
while (z < 100)
{
var fff:Object = Express.object('a:true;b:false;c:0.555;d:asdf;e:abc;array:[1,2,3];obj ect:{one:true}');
z++;
}
trace(new Date().time - t);
trace('\n\nAS3', fff, typeof fff, '\n');
for (i in fff)
{
trace(escape(i), fff[i], 'type:', typeof fff[i]);
}
trace('\n');
/************************/
z = 0;
t = new Date().time;
while (z < 100)
{
var eee:Object = lib.object('a:true;b:false;c:0.555;d:asdf;e:abc;array:[1,2,3];object: {one:false}');
z++;
}
trace(new Date().time - t);
trace('\n\nALC', eee, typeof eee, '\n', eee.object.one, typeof eee.object.one);
for (i in eee)
{
trace(escape(i), eee[i], 'type:', typeof eee[i]);
}
/********************************************************************* ***********************************************/
[TRACE]
14 //ms
AS3 [object Object] object
object [object Object] type: object
d asdf type: string
array 1,2,3 type: object
e abc type: string
a true type: boolean
b false type: boolean
c 0.555 type: number
650 //ms
ALC [object Object] object
false boolean
object [object Object] type: object
d asdf type: string
array 1,2,3 type: object
e abc type: string
a true type: boolean
b false type: boolean
c 0.555 type: number
/////////////////////////////////////////////////////////////
What is wrong??? that's not really fast in my opinion. sorry for my english
regards
After playing around with the new JSON Parser in FP11 I noticed a big increse in performance. The same algorithm only takes 0ms.
Unlike com.adobe.serialization.JSON, this new JSON class is using a native 'AS3 function'.
The same speed i can only get with haxecpp but as far as i know there is no good and clean way to implement c++ in the Flash Player.( sandbox i assume... )
I need to write native AS3 functions. Alchemy does not for work my case because you say 'cost of call to alchemy libs is high'!
thanks, much appreciate
North America
Europe, Middle East and Africa
Asia Pacific