与 Python 相比,scala 编译速度慢是阻碍在网站项目中使用它的一个因素吗?

发布于 2024-12-01 16:01:40 字数 401 浏览 4 评论 0原文

在我的网站项目中,现在使用 python 或 scala 存在冲突。反对 scala 的一个论点是它的编译时间很慢,而 Python 甚至无法编译。 根据这个问题给出的答案 为什么 IntelliJ IDEA 编译 Scala 这么慢?

所以我的问题对于一个网站来说,更重要的是要考虑什么。语言的编译时间缓慢或语言的执行速度缓慢。 scala编译时间慢是影响因素吗? AFAIK 编译的 scala 代码比解释的 python 代码运行得更快。

注意 - 语言不能扩展,但架构和代码可以扩展,这是正确的,但使用运行速度快的语言不会有什么坏处。

In my website project, there is conflict right now on using python or scala. One argument that went against scala was its slow compile time whereas Python does not even compile.
According to answers given in this question
Why does IntelliJ IDEA compile Scala so slowly?

So my question is for a website, what's more important to consider. Slow compile time of a language or slow execution of a language. Is slow compile time of scala an affecting factor?
AFAIK compiled code of scala will run faster than interpreted python code.

Note - It's right that languages do not scale but architecture and code does, but it will not hurt to use a language which runs fast.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

筱武穆 2024-12-08 16:01:41

除非您期望调试-修复-部署周期成为默认状态,并且您的应用程序如此庞大且耦合,即使在简单的更改之后也必须重新编译数十个文件,否则构建和预热时间不应该对于 Web 应用程序来说确实是一个问题。这些人经常在线数周甚至数月。一些虚拟机(著名的 HotSpot)将其用于长时间运行的应用程序的模式(其中包括明显更长的启动/预热时间,但允许生成更好的机器代码)称为“服务器”模式是有原因的。

但正如您自己指出的那样,这并不意味着您必须使用编译语言。以最适合发展的方式发展。在不太可能发生的情况下,您应该获得足够的流量来保证底层平台的性能发挥重要作用(Twitter 必须用 Scala 代码替换其 Ruby 代码以提高性能,但请注意,它多年来一直运行良好),无论如何您都可以承担重写的费用;)

Unless you're expecting the debug-fix-deploy cycle to be the default state, and your app is so huge and coupled that you have to re-compile dozens of the files even after simple changes, build and warmup time shouldn't be really be an issue for a web application. Those frequently stay online for weeks or even months. There's a reason some virtual machines (famously, HotSpot) have called their mode for long-running applications (which includes significantly longer startup/warmup time but allows generation of even better machine code) the "server" mode.

But as you noted yourself, that doesn't mean you have to go use a compiled language. Develop in whatever works best for developing. In the unlikely event you should get enough traffic for the performance of the underlying platform to matter (Twitter had to replace their Ruby code with Scala code for performance, but mind you, it worked well enough for years), you can afford a rewrite anyway ;)

终止放荡 2024-12-08 16:01:40

对于编译型语言,您只需编译一次。即使在 python 中,只有在源代码发生更改时才会生成字节码。我想这与 Scala 是一样的。寻找哪种语言运行得更快是一种愚蠢的尝试,因为这“只是另一场语言战争”。你不应该追求速度,而应该关注框架、开发的简易性、运行和维护的成本以及语言的整体“友好性”。

With a compiled language you only compile it once. Even in python the bytecode is only generated if the source has changed. I would imagine this is the same with Scala. Looking for which language runs faster is a foolish endeavor as it is "just another language war." Instead of looking for speed you should be looking at frameworks, ease of development, cost of running and upkeep and overall 'friendlyness' of the langauge.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文