ActionScript - XML/E4X Is Slow?

萝らか妹 提交于 2020-01-06 02:45:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!