Scala在Android上表现好吗?(2011年6月)

时间:2022-12-28 07:08:11

I'm very new to scala and find many of its ideas very attractive. I've just discovered the scala for android project and I'm wondering if it could be expected to run well or perhaps even better than java?

我对scala非常陌生,发现它的很多想法都很吸引人。我刚刚发现了android项目的scala,我想知道它是否可以运行得很好,甚至比java更好?

Could it even be expected do some things better than java even if the processors are mostly single core in-order execution types at the moment?

即使目前处理器大多是单核的、按顺序执行的类型,它还能比java做得更好吗?

If anyone has any example or experiences to share then please do!

如果有人有任何例子或经验分享,请做!

3 个解决方案

#1


8  

The only "lag" would be the size of the apk, but if you use something like ProGuard it would represent only around 15k/25k more, nothing significant at all. As of performance, for what i've seen is the same. I mean, it is not worse (as happens with Clojure, being dynamically typed), but i think it's the same as Java.

唯一的“延迟”是apk的大小,但是如果你使用ProGuard之类的东西,它只代表大约15k/25k,没有任何意义。就性能而言,我所看到的是一样的。我的意思是,这并不是更糟糕(Clojure是动态类型的),但我认为它与Java是一样的。

#2


2  

Yes, it does. But to keep the package size down, use Proguard.

是的,确实。但是为了减小包装尺寸,请使用Proguard。

If you use SBT, there is already some plugin which automates the whole process.

如果您使用SBT,已经有一些插件可以使整个过程自动化。

#3


0  

As with most performance-related questions, the correct answer is 'It depends'. I'm no Scala expert (yet), but from what I've seen so far, it'll be future-proof - as in, build with Scala to get better / easier multicore support - as that's the trend that's rapidly popularizing, with dual- and quadcore processors quickly becoming commonplace in high-end smartphones. For single-core and 'simple' applications that don't really do much things that can be parallized, I'm guessing performance would be equal or worse. However, performance isn't everything, especially not for prototypes or one-off applications - ease of coding and development speed are more important, in which Scala, if you're familiar with it, can help (due to less code and smarter constructs).

和大多数与性能相关的问题一样,正确的答案是“看情况”。我不是Scala专家,但是从我目前所看到的来看,它将是未来的证明——就像在用Scala构建更好/更容易的多核支持一样——这是一个快速普及的趋势,在高端智能手机中,双和四核处理器很快就会普及。对于单核和“简单”的应用程序来说,它们并不能真正做很多可以同时使用的事情,我猜想性能可能是相同的,也可能是更差的。然而,性能并不是一切,尤其是对于原型或一次性应用程序来说——简化编码和开发速度更为重要,如果您熟悉它,那么Scala可以帮助(由于代码更少,构造更智能)。

#1


8  

The only "lag" would be the size of the apk, but if you use something like ProGuard it would represent only around 15k/25k more, nothing significant at all. As of performance, for what i've seen is the same. I mean, it is not worse (as happens with Clojure, being dynamically typed), but i think it's the same as Java.

唯一的“延迟”是apk的大小,但是如果你使用ProGuard之类的东西,它只代表大约15k/25k,没有任何意义。就性能而言,我所看到的是一样的。我的意思是,这并不是更糟糕(Clojure是动态类型的),但我认为它与Java是一样的。

#2


2  

Yes, it does. But to keep the package size down, use Proguard.

是的,确实。但是为了减小包装尺寸,请使用Proguard。

If you use SBT, there is already some plugin which automates the whole process.

如果您使用SBT,已经有一些插件可以使整个过程自动化。

#3


0  

As with most performance-related questions, the correct answer is 'It depends'. I'm no Scala expert (yet), but from what I've seen so far, it'll be future-proof - as in, build with Scala to get better / easier multicore support - as that's the trend that's rapidly popularizing, with dual- and quadcore processors quickly becoming commonplace in high-end smartphones. For single-core and 'simple' applications that don't really do much things that can be parallized, I'm guessing performance would be equal or worse. However, performance isn't everything, especially not for prototypes or one-off applications - ease of coding and development speed are more important, in which Scala, if you're familiar with it, can help (due to less code and smarter constructs).

和大多数与性能相关的问题一样,正确的答案是“看情况”。我不是Scala专家,但是从我目前所看到的来看,它将是未来的证明——就像在用Scala构建更好/更容易的多核支持一样——这是一个快速普及的趋势,在高端智能手机中,双和四核处理器很快就会普及。对于单核和“简单”的应用程序来说,它们并不能真正做很多可以同时使用的事情,我猜想性能可能是相同的,也可能是更差的。然而,性能并不是一切,尤其是对于原型或一次性应用程序来说——简化编码和开发速度更为重要,如果您熟悉它,那么Scala可以帮助(由于代码更少,构造更智能)。