Reputation: 3009
I'm thinking that as more and more programming moves to the web with similar and a variety of tools and techniques, has anyone come up with a good set of benchmarks for a programming language?
I'm thinking server-side languages, like Java, PHP, ASP.net, and C# are the big ones. Though it could be anything like C or perl, I don't want to go there because it's not mainstream or even fast.
When I buy a new CPU, I can benchmark the floating point, integer, and multi-task numbers. I can bench things like rendering times.
I would think someone could develop a standard bench for simple programming tasks, and practical web serving scenarios. Preferably an independent organization. Of course you can always tweak code for performance, but I am talking simple things that can be done identically in every language. I bet it could be robust as well.
At some point for scalability, performance will be an issue for web languages. I would like to have a way to tell if a language, or better yet, the latest release of it, stacks up against the competition.
Anybody doing this yet, or should I come up with my own business?
EDIT: yes I know benchmarks are subjective, even more-so for web pages. I didn't say it would be easy, or even necessary now.. Clearly benchmarking my video card on Crysis versus Far Cry is subjective, but it is a useful real world test. That's what I'm aiming for, and for the mainstream languages. Could we see a resurgence in C if performance becomes a focus point down the road?
Upvotes: 2
Views: 9240
Reputation: 36872
There are some benchmarks out there comparing a lot of server side languages.
I've always enjoyed fractals, and was curious if scripting languages were up to the task. I wrote a very simple Mandelbrot set generator for my test. Rather than optimizing for each language, I tried to write each program in approximately the same way in each language to make a reasonable performance comparison.
Here are the results from running on my 867 mhz Powerbook G4. Shorter is better. Please note, the following benchmarks are not scientific, and were simply done to satisfy my curiosity. Your mileage may vary.
Feel free to send me ports to any other languages. The program should print the time in seconds that elapsed at the bottom in the form of 'Elapsed %0.2f'. If you can, include instructions for building on MacOS X.
Language Time Relative Speed
C gcc-4.0.1 0.05 seconds 1.00 x
ocaml compiled 3.09.2 0.05 seconds 1.00 x
SBCL 1.0.2 0.13 seconds 2.55 x
Java 1.4.2 0.40 seconds 8.00 x
Io 20070410 Vector 1.40 seconds 28.09 x
Lua 5.1 1.50 seconds 30.00 x
ocaml bytecode 3.09.2 3.76 seconds 75.15 x
Python 2.5.1 9.99 seconds 199.80 x
Ghostscript 8.51 11.66 seconds 233.12 x
Perl 5.8.6 Optimized 12.37 seconds 247.34 x
TCL 8.4 Optimized 16.00 seconds 320.00 x
Perl 5.8.6 21.75 seconds 435.00 x
PHP 5.1.4 23.12 seconds 462.40 x
Javascript SpiderMonkey v1.6 31.06 seconds 621.27 x
Ruby 1.8.4 34.31 seconds 686.18 x
Emacs Lisp 47.25 seconds 945.00 x
Applescript 71.75 seconds 1435.00 x
Io 20070410 85.26 seconds 1705.13 x
Upvotes: 2
Reputation: 11
You are talking base technologies here, which are too general to spec. The web is more about networking and telecommunications than programming languages. Signal transmission, modulation, and reception affect quality of service. Think about multiplayer games, or your back office business portal. Primary considerations about application performance might be the weather, signal noise, distance, number of people using the resource, and so on. The server characteristics and user peripheral devices are going to have a major role in the usability of your program. Lastly, will your program even work properly on different platforms. So the biggest problem for programmers is not the language, but the bugs. Don't have buggy programs. It's not the compiler. It's the code.
I had the same question. JavaScript or dot net. The answer depends on what you want to do. Doing page look and feel, simple data, or easy operations probably script, because script has a simple language structure. Complex operations or larger data store would get better performance from a more robust and structured programming language like C++.
There is also the money factor, which has a positive correlation to the sophistication of the media presentation. Everything! costs money, even your time. It may be obscure, but the cost is there. Generic (open source) is not always better, because the hidden costs spring up when you want to use someone else's resources. Often times, the $$company$$ has more efficient tools to use to manipulate the resources they own, and the tools may require a specific language or technology. That is to say, you don't always have the choice of language. That decision has already been made in the development of the resources.
Upvotes: 1
Reputation: 2692
has anyone come up with a good set of benchmarks for a programming language?
Probably not and this seems increasingly less likely to happen - see "Flawed Benchmarks" and particularly "Benchmarks are a crock".
I am talking simple things that can be done identically in every language
What makes you think you can tell that they are "done identically in every language"? The program source code might look the same but that doesn't mean the same thing is done by the language interpreters or the same processor instructions are generated by the compilers.
Upvotes: -2
Reputation: 27344
The floating point etc figures from a CPU are less subjective than a web page / webservice etc. to make a fair comparison between languages will be difficult and often the problem is how it is written, not the language itself. It would be difficult to accurately compare languages, although not impossible.
The easiest analogy for me is the database TPC scoring mechanisms are well known and do provide performance figures on the database side but when does the average developer even go look at them? Unless you are not working at an extreme level they are not your guiding factor (and even then, the DB's include optimiser shortcuts to make the TPC scores better.)
TPC made a non-profit business out of it, but it takes significant buy in from the competing products - if MS / Oracle / IBM along with the hardware vendors did not buy into it, it would not of got very far.
Could it be done? possibly, never say never, but it wouldn't be trivial at all and requires buy-in from multiple language vendors, h/w vendors etc. It's more about sales and marketting than technology at that point.
Upvotes: 0
Reputation: 180958
Are you referring to computational speed or programming productivity? Or perhaps something else?
Aside from actual number crunching speed, language quality is highly subjective, and there are those who would argue that programming productivity is more important than computing speed.
Furthermore, while many languages have common characteristics, each language has specific goals. It would be like comparing apples to oranges.
Upvotes: 0