jonnyreeves / as3-vanilla

Extract strongly typed Objects from dynamic objects without writing a single line of code!
http://www.jonnyreeves.co.uk/2011/08/getting-started-with-vanilla/
MIT License
81 stars 15 forks source link

very slow #10

Open Benraay opened 10 years ago

Benraay commented 10 years ago

Hi,

don't know where to put a comment it's not really an issue but I wanted to tell you my tests and experience maybe it can help.

First of all you have done a great work with vanilla.

The only problem i have is that its very slow compared to a basic method that consists to copy each property of an object directly

I have to manage 10000 values in a json array

with vanilla it takes 2200 milliseconds on average the TranslationData has only two fields "value" and "key" here is the code var nb:int = jsonData.length; var translations:Vector. = new Vector.; var trData:TranslationData; for(var i:int=0;i<nb;i++){ trData = new Vanilla().extract(jsonData[i], TranslationData); translations.push(trData); }

and copying directly takes 20 milliseconds on average the TranslationData has only two fields "value" and "key" here is the code

for(var i:int=0;i<nb;i++){ trData = new TranslationData(); trData.value = jsonData[i].value trData.key = jsonData[i].key translations.push(trData); }

i hope it helps