3 ms·
As the page says, "No. Which programming language implementations have the fastest benchmark programs?" Which begs the question - aside from macho bragging rig
by angusgr 15y ago
As the page says, "No. Which programming language implementations have the fastest benchmark programs?"
Which begs the question - aside from macho bragging rights, exactly what good is this kind of information?
Assume I did have a specific problem case for which performance in terms of memory, time or LoC mattered. As a first step, I'd write a specific benchmarkable implementation of my own problem (or one very like it.) Then I'd need to profile and optimise that implementation in my chosen language(s), as well as stop and think laterally about ways I might be able to optimise around that specific problem.
This is all assuming I'm working on a greenfields project where I have absolute free choice of language & runtime environment. Which happens for my personal projects, but never yet for a professional one.
Not to mention that in all other cases apart from this hypothetical where performance matters, I would take the most human-readable program over the most fast, lean or concise one.
Long story short, at no point can I see myself stopping and saying to myself. "You know what I need now? I need to see which programming language can generate a Mandelbrot set bitmap with the smallest memory footprint, without using any 'unfair' optimisation techniques."
- njharman 15y agoExactly, I can't believe (what seems like a) majority of developers are still talking about language performance (and optimization). It matters for a small subsegment of our industry. The rest, speed/cost to implement and maintain far outweigh raw language performance.
- angusgr 15y agoYes! Also, even when you do care about performance, general performance isn't ever the same as specific performance. You have to optimise to your use case, not some arbitrary general use case like "render a Mandelbrot set" or "calculate pi". If I have a slow On^2 Erlang algorithm, then I'm a lot better off looking at ways to rewrite it as Olog(n) instead of scrapping Erlang and moving to Java because it had a better score on the programming language shootout.
- igouy 15y ago> general performance isn't ever the same as specific performance http://shootout.alioth.debian.org/dont-jump-to-conclusions.php http://shootout.alioth.debian.org/dont-jump-to-conclusions.p... > scrapping Erlang and moving to Java "Most (all?) large systems developed using Erlang make heavy use of C for low-level code, leaving Erlang to manage the parts which tend to be complex in other languages, like controlling systems spread across several machines and implementing complex protocol logic." http://www.erlang.org/faq/introduction.html#id49850 http://www.erlang.org/faq/introduction.html#id49850
- angusgr 15y agoMost (all?) large systems developed using Erlang make heavy use of C for low-level code, leaving Erlang to manage the parts which tend to be complex in other languages, like controlling systems spread across several machines and implementing complex protocol logic. I know, when programming in Erlang I have unsurprisingly done exactly this. If I had an On^2 solution in Erlang that I knew I couldn't rewrite in Erlang to be faster, then that's my last resort - I'd write a C port to perform my particular inner loop performance-limited code, and leave the rest in Erlang. However, I wouldn't either (a) go directly to C without trying to optimise the solution in Erlang first, or (b) look at a list of other languages and wonder which one I could move my entire program to.
- wccrawford 15y agoIt matters sometimes. A while back, I wrote a program to solve a puzzle. The more complex the puzzle, the longer it took to solve. Today, I might come up with a better algorithm, but back then, all I could find was a brute-force approach. The most complex puzzle I had seen at the time was taking hours to run. The program was written in VB6, and it was just wasn't mean for CPU-intensive programs like that. If I were to write that program again today, I'd be looking at optimizing the code for speed, starting with the language. So yes, the question -does- matter. Sometimes.
- angusgr 15y agoToday, I might come up with a better algorithm, but back then, all I could find was a brute-force approach. The most complex puzzle I had seen at the time was taking hours to run. I bet that you could come up with a better algorithm now, even in VB6 if you had to, to get the run time down. I've seen people take "optimised" C solutions that run in hours and make them run in minutes, just by rewriting the algorithm and rethinking basic assumptions.
- igouy 15y ago(I often get this wrong: "beg the question - assume the truth of a proposition needing proof.") > ... I would take the most human-readable program over the most fast, lean or concise one And some people do look at the source code for 2 dozen languages. http://shootout.alioth.debian.org/help.php#why http://shootout.alioth.debian.org/help.php#why
- angusgr 15y agoYou're entirely correct on both counts. In fact, all 3 of those reasons given on that page are good ones. However, this was still posted under the title "Which programming language is the fastest?" - so I think it's worth exploring in exactly what ways that is or isn't useful information. Just as their own reason #3 says - "To show how difficult it can be to make meaningful comparisons" I'd also question exactly how useful reading toy benchmark solution code is to real problems. The code to the benchmark problems is often nicely written, but if I have a problem to solve then wouldn't I be better off looking for samples of readable code that solve problems related to my specific problem domain?
- igouy 15y ago> worth exploring in exactly what ways that is or isn't useful information Now consider how you could use the varying performance on different tasks, and the varying performance on the same task of programs written in the same programming language, as examples (as a resource) for exploring (and showing to others) in what ways you think that is or isn't useful information. If we just consider those "Which programming language is the fastest?" pages, then I think - simply getting someone to look away from a single number ranking (the median) and notice that for some language implementations the performance range is relatively small but for others the range is enormous - is useful. > I'd also question exactly how useful reading toy benchmark solution code is to real problems. Someone's told me that n-body pretty much is what they get paid to work on. Someone's told me that k-nucleotide and reverse-complement are pretty much is what they get paid to work on. The question as usual is who's "real" problems? > wouldn't I be better off looking for samples of readable code that solve problems related to my specific problem domain? Perhaps - and yet for some people what they see in those tiny tiny programs will be enough for a personal opinion about whether X is "the most human-readable".
- hitechsites 15y agoWhile one specific benchmark may not sway your decision on which programming language to use for your own projects, it should certainly be a factor when designing a large web application for hundreds of thousands of users. Unless of course you say that benchmarks are irrelevant and do not measure anything that corresponds to real world performance. But that would be like saying it does not matter whether you use a bicycle, a car, or a jet engine to travel from Point A to Point B, since intrinsic speed of your choice mode of transportation is difficult to measure, and is irrelevant.
- angusgr 15y agoWhile one specific benchmark may not sway your decision on which programming language to use for your own projects, it should certainly be a factor when designing a large web application for hundreds of thousands of users. Sure, but the benchmark has to fit the use case. If you're designing a large web application, find benchmarks for large web applications or write benchmark cases yourself that match the use cases you're going to see and think you need to optimise for.