问题
i've been reading that XML/E4X is very slow with AVM2 / ActionScript 3.
when supplying an application with XML data, is it always generally a better idea to parse the XML object into an array of objects to call rather than using E4X with the stock XML data?
回答1:
Aside from the performance issue, it would be a good idea to decouple your application from the data source.
Let's say , for example, that you'd like to use JSON in the future... It'd be more flexible to pass the XML data to an Object and manipulate your data from that Object , rather than accessing the XML directly.
回答2:
I don't have a lot of experience with it but I have always heard that e4x in the fp was pretty fast, but I would transfer everything over to objects to actually use in your application. This has the advantage of letting your compiler check your properties and types. You would still probably use e4x to translate your xml into objects, but using them as objects should be easier and faster IMHO.
来源:https://stackoverflow.com/questions/4167960/actionscript-xml-e4x-is-slow