正整数总是比数/漂浮在AS3快? [英] Are ints always faster than Numbers/Floats in AS3?

查看:169
本文介绍了正整数总是比数/漂浮在AS3快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

闪存被称为表现得非常不predictable方式方法,当涉及到操纵数据。我很好奇,如果有任何性能/内存的好处在于使用数字而不是整数除了需要precision值。我听说,在Flash中的一些基本操作可以将多次在两个类型之间的转换前pression。我还听说,Flash运行时,引擎盖下,实际上映射整数到非precision号/花车在运行时。是任何这样的吗?

Flash is known to behave in very unpredictable ways ways when it comes to manipulating data. I'm curious that if there is any performance/memory benefit to using Numbers instead of ints aside from values that need precision. I have heard that some basic operations in Flash may convert multiple times between the two type to resolve the expression. I've also heard that Flash runtime, under the hood, actually maps ints to non-precision Numbers/Floats during runtime. Is any of this true?

推荐答案

Flash运行时是一个黑暗的地方确实如此。

Flash runtime is a dark place indeed.

  • 正如你所提到AVM2 <一href="http://stackoverflow.com/questions/9447517/in-actionscript-3-why-is-the-dynamic-type-of-large-int-values-number">does大转换成整数数。
  • 在整数的actualy整数。
  • 还有的约整数更多的东西。
  • 在过去被缓慢的在循环中使用但现在,他们都没有(结果在文章中Uints似乎是一个组合奇怪的字节code生成和JIT优化)。
  • 在数字需要更多的内存空间,但是这是什么相比,即使是一个JPEG文件。
  • 在逻辑上感觉不如用 uints 的循环。
  • 数字是浮点falues​​你必须要小心,对它们进行比较。
  • As you mentioned AVM2 does convert big ints into Number.
  • Whole Numbers are actualy ints.
  • And there's more stuff about ints.
  • Uints used to be slow used in a loop BUT NOW THEY ARE NOT (results in the article seem to be a combination of weird bytecode generation and JIT optimizations).
  • Numbers take more space in memory but this is nothing compared to even a single JPEG file.
  • Logically it feels better to use uints in loops.
  • Numbers are floating point falues you have to be careful comparing them.

杰克逊·邓斯坦确实pretty的不同AS3语言的良好测试构造的性能。当然,这是一件好事,你自己检查的结果。从一系列关于10.2的表现,你可以看到,每一个新的Flash Player版本,他们优化的东西,但其他的事情可能会更慢: 1 < A HREF =htt​​p://jacksondunstan.com/articles/1079> 2 3

Jackson Dunstan does pretty good tests of different AS3 language constructs performance. Of course it's always good to check results yourself. From the series about 10.2 performance you can see that with every new Flash Player version they optimize something but other things might get slower: 1 2 3.

P.S。这个答案可能会得到老很快,可能也将在一两年后提到这当然会是错误的。

P.S. This answer might get old very soon and might as well be cited in a couple of years later which of course will be wrong.

这篇关于正整数总是比数/漂浮在AS3快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆