3 ms·
I'm not sure there's even a slight edge in performance these days and even if there were, you have more options with Ruby/Python (e.g. IronRuby/IronPython for t
by danssig 15y ago
I'm not sure there's even a slight edge in performance these days and even if there were, you have more options with Ruby/Python (e.g. IronRuby/IronPython for the JVM, etc.).
- jbert 15y agoOne data pt - micro benchmark on the default versions of perl/python/ruby on ubuntu 11.04. Sum the numbers up to 10,000,000 using a straight while loop. Run several times on idle system, took representative value. Runtime includes startup time. I know this is a dumb benchmark, but I think it backs up my general pt about performance above. (JVM/CLR implementations are interesting - are they widely used?) python2.7.1: 2.0s perl5.10.1: 1.3s ruby1.8.7: 4.3s python code below (perl+ruby are direct transliterations. Yes, there may be a more idiomatic way to write it in all languages, I'm trying to do a very simple apples-to-apples comparison of each languages dominant production VM implementation): total = 0 i = 10000000 while (i > 0): total += i i -= 1 print "total is ", total
- danssig 15y agoI meant to say "in general performance", i.e. of a complete application. Micro benchmarks mean less than nothing in that case. Python is obviously plenty fast: Blender (3D modeling application) is written in it. There is also Twisted and all that other stuff. >are they widely used? My impression is that they are. The JVM is everywhere these days.
- jbert 15y ago> I meant to say "in general performance", i.e. of a complete application. Micro benchmarks mean less than nothing in that case. Could you give me some info on why you think there isn't a performance edge "these days"? Or are you making the point that all these languages are "fast enough" and so a perf difference between them isn't important for real-world use? > Blender (3D modeling application) is written in it. I'm surprised that the performance-critical parts are in python. Do you know if the rendering etc is in python or is it at python UI on a C core?
- danssig 15y ago>Or are you making the point that all these languages are "fast enough" and so a perf difference between them isn't important for real-world use? I'm saying perl might be faster at some loop that adds 1s together, but ruby might be faster at networking and python might be faster at method calls, etc. When you weight it all together it equals out. In other words, if you wrote a big enterprise trading application in all 3 languages (i.e. write it 3 times with the best practices of each language) and then only looked at charts showing various performance benchmarking results of the application I think you'd find all 3 very close in performance. >Do you know if the rendering etc is in python or is it at python UI on a C core? I thought it was last time I looked but I'm not certain.
- DrPheltRight 15y agoI believe IronRuby and IronPython are actually for .NET whereas JRuby and Jython are for the JVM.
- danssig 15y agoYou're right, of course. So that means that while perl runs on every major OS, python and ruby run on every major OS, the JVM and the CLR (and can use the libraries from each of these).