这三个中的哪一个是ActionScript 3中AVM2上最快(最少的CPU周期)?
Object(instance).constructor
(instance as Object).constructor
instance["constructor"]
我会做一些测试,但我不知道如何准确地描述那种事情.
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– performancetests.Constructors (5 iterations, 5,000,000 loops through each) Player version: MAC 10,0,32,18 (debug) –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– method...................................................ttl ms...avg ms instanceAsObjectConstructor 9516 1903.20 instanceBracketConstructor 6941 1388.20 objectDotConstructor 9916 1983.20 ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
我使用了Grant Skinner的AS3 Performance测试工具并获得了这些结果.