开发者

Performance-focused desktop-program: Ruby or Go?

开发者 https://www.devze.com 2023-03-18 08:51 出处:网络
I currently don\'t know either of the two languages. Design of a piece of software is close to complete.

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 pro开发者_JAVA技巧gram. Technical and especially perceived speed should be high. Startup time is especially important.


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.


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.


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

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消