这三个中的哪一个是ActionScript 3中AVM2上最快(最少的CPU周期)?
Object(instance).constructor
(instance as Object).constructor
instance["constructor"]
我会做一些测试,但我不知道如何准确地描述这种事情。
答案 0 :(得分:6)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
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's AS3 Performance test harness并得到了这些结果。