英文:
Performance-focused desktop-program: Ruby or Go?
问题
我目前对这两种语言都不了解。一款软件的设计接近完成。
有趣的是:
- Ruby:令人愉快。遵循思维过程。为人类设计。
- Go:性能良好。编译速度快。
我不了解Ruby的性能。如果它比Go慢很多,我会选择后者(这里指的是典型的速度)。
我最终会学习这两种语言,但现在,这将决定我先学哪一种。
更新:这是一个非常基本的图像编辑程序。技术和尤其是感知速度应该很高。启动时间尤为重要。
英文:
I currently don't know either of the two languages. Design of a piece of software is close to complete.
The intriguing:
- Ruby: Enjoyable. Follows thought process. Made for humans.
- Go: Good performance. Fast compile times.
I don't know about Ruby's performance. If it's a lot slower than Go, I'll go with the latter (talking about typical speed here).
I'll learn both eventually, but right now, this will determine which one first.
Update: It's a very basic image-editing program. Technical and especially perceived speed should be high. Startup time is especially important.
答案1
得分: 9
很遗憾,对于桌面图像编辑程序来说,这两种语言都不合适。
你没有告诉我们你打算使用哪个桌面环境,我假设你要么使用Windows,要么使用Mac。
Ruby不合适,因为它不满足你的两个要求:
- 它的启动时间很糟糕,因为在启动时它必须初始化一个相当复杂的虚拟机,这涉及加载它的标准库的相当大的部分。
- 它在图像处理所涉及的计算方面非常慢(与C/Java/Go相比)。
Go是静态链接的,并且编译为机器码,因此它的启动时间非常好,速度接近C(也就是说,在选择C/C++之后,它是你可以希望选择的最快的语言)。
然而,Go完全不支持编写Mac桌面应用程序(即它没有与Objective-C/Cocoa运行时的桥接),而且对于编写Windows桌面应用程序的支持非常差。
如果你在使用Windows,唯一能提供快速启动时间的语言是C/C++/Delphi。C#可能有可以接受的启动时间,并且对于这个任务来说速度足够快(非常流行的paint.net就是用C#编写的,你可以找到一个旧版本的代码,它是BSD许可证的,可以重用很多代码)。
对于Mac,我建议使用Objective C - 它是该平台的本地语言,文档最全面,拥有最好的免费开发工具(XCode)。你可以使用https://github.com/philippec/Pixen作为起点。
英文:
Sadly, neither language is appropriate for a desktop image editing program.
You haven't told us which desktop you have in mind, I'll assume it's either Windows or Mac.
Ruby is not appropriate because it fails 2 of your requirements:
- it has a terrible startup time because at startup it has to initialize a rather complicated VM, which involves loading quite a big part of its standard library
- it's very slow (compared to C/Java/Go) doing the kind of computations that image processing entails
Go is statically linked and is compiled to machine code, so its startup time is excellent and the speed is close to C (i.e. it's the fastest language you can hope to choose after C/C++).
However, Go has no support whatsoever for writing Mac desktop apps (i.e. it has no bridge to Objective-C/Cocoa runtime) and the support for writing Windows desktop apps is extremely poor.
If you're doing Windows, the only language that gives you fast startup time is C/C++/Delphi. C# might have acceptable startup time and it's fast enough for the task (very popular paint.net is written in C# and you can find an old version of the code which is BSD-licensed and re-use a lot of its code).
For Mac, I would recommend Objective C - it's the native language of the platform, best documented and with the best, free dev tools (XCode). You can use https://github.com/philippec/Pixen as a starting point.
答案2
得分: 2
你真的需要给我们一些关于你认为什么是好的和坏的性能的想法,因为这是一个非常主观的主题。
例如,人们通常愿意在易于使用或开发的系统上交换一定数量的技术或感知速度。而且这也取决于你想要做什么。每种语言都有其自身的优点和缺点。Ruby在某些方面可能比Go更快。然而,如果你真的需要速度,也许你应该考虑一种更接近底层的语言,比如C。
有时候,用户对速度的要求也是主观的。我曾经有一个系统,用户认为它在执行特定任务时花费的时间太长。从技术上讲,没有办法加快速度,所以我给“处理中…”窗口添加了动画效果。因为用户现在可以在屏幕上看到一些“发生”的东西,他们认为速度更快了。但实际上,用秒表计算,它实际上比之前慢了几秒钟。
英文:
You really need to give us some idea as to what you consider to be good and bad performance because it's a very subjective subject.
For example, people are usually willing to trade a certain amount of technical or perceived speed for a system that easier to work with or develope. Plus it also matters what you are tying to do. Each language has it's own strengths and weaknesses. Ruby may be faster at some things than Go. Then again, if you really need speed, perhaps you should be looking at a language that is closer to the metal such as C.
Sometimes though, requests for speed from users are subjective too. I once had a system that the users thought was taking too long to do a specific task. There was no way technically to speed it up, so I animated the "Processing ..." window. Because the users could now see something "happening" on the screen, they thought it was going faster. On a stop watch, it actually took a couple of seconds longer.
答案3
得分: 0
我认为这些语言是你在性能关键应用中选择的最差的。我对Go不太了解,但Ruby与Python相似(甚至更慢),而Python非常慢。根据我所阅读的,Go比Ruby快得多,但与其他编程语言相比仍然慢两到三倍...当然,这取决于你想做什么,例如我不会选择任何一种语言来进行实时物理模拟等。
我已经使用Python工作了几年,它真的很慢,我确定你会讨厌它,而Ruby与Python非常相似,但它更慢,但由于Go太新了,我对它不太了解,无法说出更多信息。
英文:
I think those languages are the worst you can choose for performance-critical application. I don't know much about Go, but Ruby is similar to Python (even slower) and Python is slow as hell. As i've been reading, Go is much faster than Ruby, but still is like two or three times slower compared to other programming languages... It depends on what are you trying to do, of course, ie. I wouldn't choose any of those for real-time physics or something like that.
http://shootout.alioth.debian.org/u32/performance.php?test=nbody
https://stackoverflow.com/questions/2704417/why-is-go-language-so-slow
http://attractivechaos.github.com/plb/
I've been working with python for a couple of years and it's really slow and I'm sure you will hate it and Ruby is very similar to Python and it's slower but as Go is too new I don't really know much about it, I can't tell..
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论