Slashdot Mirror


Comparing the Size, Speed, and Dependability of Programming Languages

In this blog post, the author plots the results of 19 different benchmark tests across 72 programming languages to create a quantitative comparison between them. The resulting visualizations give insight into how the languages perform across a variety of tasks, and also how some some languages perform in relation to others. "If you drew the benchmark results on an XY chart you could name the four corners. The fast but verbose languages would cluster at the top left. Let's call them system languages. The elegantly concise but sluggish languages would cluster at the bottom right. Let's call them script languages. On the top right you would find the obsolete languages. That is, languages which have since been outclassed by newer languages, unless they offer some quirky attraction that is not captured by the data here. And finally, in the bottom left corner you would find probably nothing, since this is the space of the ideal language, the one which is at the same time fast and short and a joy to use."

101 of 491 comments (clear)

  1. what about APL by goombah99 · · Score: 2, Insightful

    APL was faster than C and there has never been a more terse language.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:what about APL by mdmkolbe · · Score: 4, Informative

      If you would like APL to be on the list, then submit benchmarks for APL to the Shootout (the blog got its data fro there). The Shootout is mainly driven by user submissions. They do have some fairly strict rules about how to submit. However, if you can name an implementation (along with enough guidelines to make installing it easy) and provide a reasonably full set of benchmarks, then the language will generally be added.

      One tip about submitting though: try to make life as easy as possible for the guy who runs it. He doesn't have time to figure out typos or to fix "easy" bugs in some programming language they he may not even know.

    2. Re:what about APL by Anonymous Coward · · Score: 2, Funny

      But it is so much easier to make snarky comments, eh?

      [citation needed]

    3. Re:what about APL by Hucko · · Score: 2, Interesting

      Snarky et al are ancient words used up to the 60s; their resurgence can only make me hope that we are potentially seeing the return to precise use of language. This would be a fantastic event; a reversal of the trend to the dilution of semantics and language in general.

      Of course my use of 'et al' is symptomatic of this, as is the common use of acronyms for everything... Ah weel, it was a nice idea while it lasted

      --
      Semi-automatic amateur armchair Australian philosopher; conjecture ready at any moment...
    4. Re:what about APL by V!NCENT · · Score: 2, Insightful

      Citation needed.

      --
      Here be signatures
    5. Re:what about APL by DavidHumus · · Score: 2, Insightful

      Some of us have submitted programs in APL, or its younger sibling J, to the shootout (see http://www.mail-archive.com/general@jsoftware.com/msg02859.html). However, since the rules of the shootout specify the algorithm you have to use, you end up writing C programs in APL or J which is no way to take advantage of the power and expressiveness of these languages.

      It's like taking part in a poetry contest where you're only allowed baby-talk.

  2. Why is Verbosity Bad? by eldavojohn · · Score: 5, Insightful
    This plots verbosity against slowness making:

    And finally, in the bottom left corner you would find probably nothing, since this is the space of the ideal language, the one which is at the same time fast and short and a joy to use.

    I must ask why the author assumes that verbosity is bad and why lack thereof makes it a "joy to use."

    I think verbosity in moderation is necessary. I have read many an article with developers arguing that they don't need to document their code when their code is self-documenting. Do you make all of your variables and class/function/methods a single character for the sake of verbosity? I hope not. And I would think that reading and maintaining that code would be far less than a joy.

    I don't even need to argue this, according to his graphs we should all be using Regina, Mlton or Stalin (a scheme implementation). But instead languages like Java and Perl and C++ prevail. And I would guess that support and a mediocre range of verbosity are what causes that.

    Great work in these graphs! But in my opinion, verbosity when used in moderation--like a lot things--is far better than either extreme.

    --
    My work here is dung.
    1. Re:Why is Verbosity Bad? by xZgf6xHx2uhoAj9D · · Score: 5, Insightful

      I agree totally about the need for verbosity. I'm a fan of Donald Knuth in this regard.

    2. Re:Why is Verbosity Bad? by jbolden · · Score: 4, Insightful

      Look where those languages are on the chart.

      Java mostly against the left wall (i.e. mostly as fast as C). Perl right against the bottom (i.e. very small code).

      It appears to me what this showed was that people like the walls.

    3. Re:Why is Verbosity Bad? by ucblockhead · · Score: 5, Insightful

      The author is not talking about verbosity in bytes. He's talking about verbosity in code points. Talked about in this way, a thirty character variable name is no more verbose than a single character variable name.

      --
      The cake is a pie
    4. Re:Why is Verbosity Bad? by ClosedSource · · Score: 2, Insightful

      Overloading symbols is often a negative aspect. C would be a much easier language to read if "*" had a single meaning.

    5. Re:Why is Verbosity Bad? by A+beautiful+mind · · Score: 4, Funny

      It appears to me what this showed was that people like the walls.

      True enough, but my favourite is Larry Wall.

      --
      It takes a man to suffer ignorance and smile
      Be yourself no matter what they say
    6. Re:Why is Verbosity Bad? by nametaken · · Score: 2, Interesting

      It didn't seem to me like being concise or verbose was a help or hindrance aside from his comment. Per those graphs I could say I want something as fast as Java (how often have you heard that on /.), but a little less verbose... "oh, csharp might be worth a look".

      I found it interesting.

    7. Re:Why is Verbosity Bad? by lethargic8 · · Score: 2

      Perl prevails?

    8. Re:Why is Verbosity Bad? by tknd · · Score: 3, Insightful

      There's good verbosity and bad verbosity. Let's take for example java's System.out.println. This is bad because it is such a common function that you are bound to use it over and over again but good of course because you know it is not a keyword (it comes from the System.out library). The result is something twice as long as it needs to be and chews up screen space. As a human reader of the source, this becomes cumbersome and harder to read the full program.

      Languages that can allow you to pull in identifiers from other scopes can solve this issue while reducing the bad kind of verbosity. For example in perl there is something called Exporter which allows defined symbols by the source package to be imported into the current scope through syntax like:

      use Some::Package qw( someFunction );

      Now instead of Some::Package::someFunction, for the rest of the file I can just do someFunction since I've already declared I'm importing it at the top. If the reader is interested in knowing where someFunction comes from, searching from the top of the file will reveal the use Some::Package qw( someFunction ); line.

    9. Re:Why is Verbosity Bad? by rah1420 · · Score: 2, Insightful

      (*) Assuming you don't "cheat" by not breaking your lines where normal programmers would.

      And that's why I've often used "ELOC," or Executable lines of code.

      An
      ELOC
      metric
      for
      this
      would
      count
      this
      as
      a
      single
      sentence. :)

      --
      Mit der Dummheit kämpfen Götter selbst vergebens.
    10. Re:Why is Verbosity Bad? by bcrowell · · Score: 2, Insightful

      The justice or injustice of your comment depends strongly on what metric they're using for size, and a lot of the replies to your comment have been speculating about what the metric really is. Okay, if you start with the game's FAQ, it looks like there are three different metric they actually computed:

      1. size of the source code, in bytes
      2. "gzip bytes," which they define as follows: "We started with the source-code markup you can see, removed comments, removed duplicate whitespace characters, and then applied minimum GZip compression."
      3. amount of memory used when running

      Obviously these are going to give completely different results. Java will come out looking awful by measure #3, for instance. The difference between #1 and #2 has more to do with the distinction between terseness and expressiveness. You wrote "Do you make all of your variables and class/function/methods a single character for the sake of verbosity? I hope not." If someone did that, it would have a huge effect on #1, but little or no effect on #2. Actually #2 seems to me like a very reasonable measure of expressiveness.

      So now the question is which one the author of the article actually used for his plots. He doesn't say explicitly which one he used. However, he has links to the source code he used to generate the plots, and to the data file he used as input. The data file only has metrics #1 and #3, so it looks like he didn't actually use metric #2, which IMO is the only one that measures expressiveness in the way he obviously intended. If you look through his lisp code, it looks to me like he actually used #1. (See the line that reads "(normalize-accross (normalize-accross data 'cpu) 'size))". My lisp is pretty weak, but I believe he's extracting the columns whose names begin with the strings "cpu" and "size.")

      So it looks to me like he picked the wrong metric, which makes your criticism valid, but that just means he should have picked the right metric.

      Even the right metric, #2, still wouldn't be a perfect proxy for expressiveness, of course. For instance, a language with static typing and no type inference will require the programmer to expend a lot of characters on declarations. However, that's a matter of taste; some people feel safer with static typing.

    11. Re:Why is Verbosity Bad? by timeOday · · Score: 5, Insightful

      I'm not sure we're sharing a definition of "verbosity. Perhaps the useful definition here is "the inverse of expressiveness." Of course expressiveness is inherently relative to what is important in a given application. For most purposes, assembler is hopelessly verbose, or lacking in expressiveness, since most of what you're writing out is meaningless detail. But for certain other purposes (performance) those details become crucial, so for that application only assembler has the necessary expressiveness. Again, I am not contradicting myself by saying assembler is both lacking in expressiveness and high in expressiveness, it depends on the application. I've heard German is a fantastic language for writing technical legal documents, whereas the Inuit language is supposedly very good for describing cold weather and snow.

    12. Re:Why is Verbosity Bad? by s_p_oneil · · Score: 2, Informative

      verbosity != self-documented

      Ruby example:
      do_something() if some_time 7.days.ago

      To me, this line of Ruby code is perfectly clear and self-documented. It is also about as short as you could make it. If I had to write the same code in Java, it would be long enough that I would feel it required a comment.

    13. Re:Why is Verbosity Bad? by A.Gideon · · Score: 2, Insightful

      There's "verbosity" and there's "verbosity".

      One form - which is I think how the original article used it - is that individual statements accomplish little work. For example, they move a byte into a particular location in contrast to languages which have statements that do things like apply filters to lists' content. These are languages which require verbosity on the part of the author to accomplish work.

      These are more work to write because one must break tasks down further. They're also more work to read because the reader must assimilate a greater number of statements to grasp the work being performed from a higher level perspective.

      Another form of verbosity is intended to provide additional context for subsequent readers of code. APL can provide the counter-example of this, where code can be so terse that the original intent is lost.

      Too many still forget that the time of the reader of the code is more valuable that the time of the writer in most cases, for the simple reason that there's one writer but many readers (including the writer him/herself a few days/weeks/months/years later *grin*). Making code that's easier to read is important for maintenance and extension.

      That kind of verbosity is a Good Thing.

    14. Re:Why is Verbosity Bad? by K.+S.+Kyosuke · · Score: 2, Insightful

      Why should I mod up a statement like "verbosity is the inverse of expressivenes" when I disagree? And I don't think I am the only one unless "expressiveness" means something completely different than I thought. Unfortunately, there seems to be no formal definition, but I like the approach outlined in Felleisen's On the Expressive Power of Programming Languages.

      For example, I consider Scheme more expressive than, e.g., COBOL (at least the older standards, haven't seen the newer ones), since COBOL has no notion of lexical closures, first-class functions etc. On the other hand, Bourne shell does not have these notions either, yet shell scripts tend to be quite compact when applied to tasks for which shell is a suitable tool. Scheme actually has to go out of its way if you want to write equivalent scripts of comparable length in it, which is why projects like scsh have emerged. I find it really difficult to correlate expressiveness and verbosity in any simple way.

      --
      Ezekiel 23:20
    15. Re:Why is Verbosity Bad? by cryptoluddite · · Score: 3, Informative

      2. "gzip bytes," which they define as follows: "We started with the source-code markup you can see, removed comments, removed duplicate whitespace characters, and then applied minimum GZip compression." ... actually #2 seems to me like a very reasonable measure of expressiveness

      I'm not so sure about that. For instance, their preprocessing effectively gives Python free blocks, by removing repeated spaces but not removing { and } from other languages. What they should do is:

      1. remove all comments

      That's it. You don't need to remove whitespace at all... gzip will compress 10 spaces to roughly the same as 1 space, if it's regular, but reducing 4, 8, 12 runs of spaces to 1 will affect the compression. You don't need to rename variables, because AReallyLongVariable used a dozen times will be amortized away if it is used often... it won't affect the gzip size much more than calling it 'a1'. They should also use maximum compression (that's the point of compressing it in the first place, to reduce it to the essential structure)... they should use 7zip or rar. So IMO their preprocessing of the source is creating a misleading metric.

    16. Re:Why is Verbosity Bad? by bcrowell · · Score: 4, Informative

      whereas the Inuit language is supposedly very good for describing cold weather and snow.

      That's a myth.

    17. Re:Why is Verbosity Bad? by ChrisMaple · · Score: 3, Insightful

      One thing in C that many people complain about is that it's too easy to get in trouble with pointers. Part of this problem is due to the way that pointers are declared often looks different from the way pointers are used, particularly if pointers and array indexes are freely interchanged. The confusion is due to a poorly chosen system of expression.

      --
      Contribute to civilization: ari.aynrand.org/donate
    18. Re:Why is Verbosity Bad? by bcrowell · · Score: 3, Informative

      The author is not talking about verbosity in bytes. He's talking about verbosity in code points. Talked about in this way, a thirty character variable name is no more verbose than a single character variable name.

      That's incorrect. He is talking about verbosity in bytes. Take a look at his source code and the data file he used, which are linked to from TFA.

    19. Re:Why is Verbosity Bad? by ArcadeNut · · Score: 4, Insightful

      verbosity != self-documented

      Ruby example:
      do_something() if some_time 7.days.ago

      To me, this line of Ruby code is perfectly clear and self-documented. It is also about as short as you could make it. If I had to write the same code in Java, it would be long enough that I would feel it required a comment.

      This is where so many programers go wrong. The code is self documenting in the respect that you know it's checking the age of something to see if it was 7 days ago, but you have no idea WHY it's checking that. Why not 6 days ago? What if it's 8 days ago?

      Comments should say WHAT and WHY you are doing something not HOW you are doing it. The HOW is the code itself. If someone was to look at that code, do they know what your intent was? Were you looking for something that was exactly 7 days old, or something 7 days old or older.

      --
      Visit the Arcade Restoration Workshop @ http://www.arcaderestoration.com
    20. Re:Why is Verbosity Bad? by KangKong · · Score: 4, Informative
    21. Re:Why is Verbosity Bad? by dpilot · · Score: 4, Insightful

      Vermont ski areas have more words for "snow" than the Inuit.

      But they all mean "ice".

      --
      The living have better things to do than to continue hating the dead.
    22. Re:Why is Verbosity Bad? by ThePhilips · · Score: 2, Informative

      I recall seeing a study that showed that bugs per line of code(*) was fairly constant across languages. (Anyone know what study that was?) Thus the fewer lines of code(*) in your program the fewer bugs. Thus more expressive languages are better.

      I do not remember the source of the study, but you got it wrong anyway.

      The result of study was that amount of bugs per [effective] line of code depends solely on programmer. Different languages have different code density, yet programmer makes literally same amount of bugs regardless of language.

      I have seen apparently perfect one-line Perl programs - which had 3+ bugs in them. If the same person wrote it say in Java, then it would have been say 25 lines of code, but very highly likely number of bugs remained the same.

      --
      All hope abandon ye who enter here.
  3. Related site... by viyh · · Score: 4, Informative

    This site is awesome. It's very simple. They have over code in over 1200 different languages that spits out the lyrics to the "99 bottles of beer on the wall" song. Check out the perl example (yes, it really does work): http://99-bottles-of-beer.net/language-perl-737.html

    --
    "I have never let my schooling interfere with my education." --Mark Twain
    1. Re:Related site... by alvinrod · · Score: 4, Insightful

      What's so special about it? It looks just like a regular perl program to me. /ducks

    2. Re:Related site... by viyh · · Score: 4, Insightful

      Perl is all of the above; it is what you want it to be. That's the beauty of it. It can be a completely obfuscated ASCII art drawing or it can be a very concise, to-the-point one-liner or anything in between. It's the Swiss army chainsaw.

      --
      "I have never let my schooling interfere with my education." --Mark Twain
    3. Re:Related site... by CastrTroy · · Score: 3, Insightful

      Run Javascript through an obfuscator, and see how readable it is. "readable in all circumstances" can't possibly exist. Anybody could make unreadable code in any language.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    4. Re:Related site... by Anonymous Coward · · Score: 5, Interesting

      Show me a language impossible to write ugly code in, and I'll show you a language which is unnecessarily restrictive.

      If you can't recognize the beauty in near infinite flexibility and the associated amount of power provided, you're not qualified to participate in such a discussion. Come back when you've gotten to know some actual talented programmers. One way to identify those programmers is that they don't blame their tools for their own incompetence.

    5. Re:Related site... by ThePhilips · · Score: 2, Insightful

      I'd prefer a language which restricted my thinking in beneficial ways to one which left me entirely my own devices.

      "Restricted [...] thinking"? So instead of doing more with the same tool, you want to do less?? and buy more other tools to do the rest???

      Honestly, I see "restricted thinkng" applicable only to developer who are not mature yet or are refusing on improving themselves. Just like guilds of past v. industry of today. In past there were skillful craftsmen - now we have some random folks off the street who simply punch a button for the 8 hours with lunch break.

      I hope that llama-isation of software development would happen after my retirement....

      --
      All hope abandon ye who enter here.
  4. Scala by Laz10 · · Score: 3, Interesting

    I am surprised how they manage to get scala to perform so much worse than pure java.

    Scala compiles to pure java .class files and uses static typing and the makes claim that the bytecodes are almost identical.

    I wonder if the benchmarks are executed in the same environment.
    http://shootout.alioth.debian.org/ has a Gentoo label behind the java benchmarks, but not the Scala one.

    1. Re:Scala by jbolden · · Score: 4, Insightful

      Functional languages in practice often implement nlog n algorithms in quadratic time or memory. One of those in a bench mark is devastating. We really understand how to optimize imperative languages well, we don't have the same level of knowledge / experience regarding functional.

      I agree this is a pity, but there doesn't seem to be any easy solution. Hopefully this gets fixed over the next generation.

    2. Re:Scala by kipton · · Score: 3, Interesting

      I am surprised how they manage to get scala to perform so much worse than pure java.

      Scala does generate optimized Java byte code. Pretty much any Java code can be directly ported to Scala with nearly identical performance.

      The Scala benchmarks perform worsethan Java's, on average, for two main reasons. The first is that some of the tasks have been implemented using higher level code (think memory allocation and closure generation), trading conciseness for performance. The second is that the Scala benchmarks haven't been tuned and tweaked to the extent that the Java ones have.

      Then there are a couple benchmarks where Scala's performance is hugely worse than Java. This seems to be because the Java benchmark was implemented using optimized native libraries (big integers as I recall) or using a better algorithm. Again, Scala could achieve equivalent performance in principle, but someone needs to invest the time to update the benchmark implementations.

    3. Re:Scala by DetpackJump · · Score: 3, Insightful

      I was curious about that too, so I'm looking at the code. The Java implementation seems to be importing a non-java library, jgmplib. Anyone know what is going on here?

    4. Re:Scala by DoofusOfDeath · · Score: 2, Informative

      With the impure languages optimization becomes much much easier.

      Funny you should say that. I'm just starting my dissertation work on parallelizing purely functional languages. (Yes, I know that topic was nearly beaten to death in the 1990's and earlier.)

      But anyway, optimizing the *parallelization* of a functional language can be a lot easier (in some ways) when the language *is* pure. At least, according to my background reading so far.

  5. Java by Allicorn · · Score: 2, Funny

    Oh but Java is a plodding, stumbling, lumbering, slug of slowness. All thoroughly indoctrinated Slashdotters know that already. No need to RTFA...

    --
    OMG!!! Ponies!!!
    1. Re:Java by Timmmm · · Score: 2, Interesting

      "Oh but Java is a plodding, stumbling, lumbering, slug of slowness."

      Java does well in these kinds of synthetic tests because it doesn't have to invoke the garbage collector. All the *real life* java programs I use are significantly slower than roughly equivalent C++ programs. E.g. compare NetBeans to Visual Studio, or Azereus to uTorrent. I tried Eclipse once but it was unusably slow.

      Find me a speedy desktop Java program and I'll change my mind about it.

  6. The perfect language exists, you ignorant clod! by tomhudson · · Score: 5, Funny

    And finally, in the bottom left corner you would find probably nothing, since this is the space of the ideal language, the one which is at the same time fast and short and a joy to use."

    Plain ASCII. The shorter and faster it is, the more joy it is to use.

    What can compare to the joy and speed of, for example, the command "Go fuck yourself!"

    Even shorter and faster syntax: the command "F.U.!"

    And for conciseness of comments - "SHIT!" and "oops!" and "WTF???"

    Looping constructs: "Sit on it and rotate!"

    If-else constructs: "Dat so? F.U. 2!"

    foreach: "You, your mamma, and the horse you rode into town on!"

    Exit statements : Just fuck off!"

    c-style assertions: "Eat shit and DIE!"

    #defines: "#define YOU One dumb motherfucka"

    conditional #includes "#ifdef YO_MAMMA"

    real-time peremption: "I OWN you, beotch!"

    1. Re:The perfect language exists, you ignorant clod! by KangKong · · Score: 2, Informative
  7. Pet peeve by QuoteMstr · · Score: 5, Insightful

    Programming languages don't have attributes like size and speed: implementations of these languages do. Take Common Lisp for example: SBCL is blazing fast, while CLISP is rather pudgy (albeit smaller). Any conforming Common Lisp program will run on both. Or consider Python --- IronPython and CPython have different performance characteristics. (I'm too lazy to link these now.)

    Point being, describing a programming language as "fast" makes about as much senese as describing a natural, human language as "smart".

    1. Re:Pet peeve by Anonymous Coward · · Score: 4, Insightful

      A badly-written Assembler program will never achieve the speed of a reasonably-written C++ program. And most people cannot write good Assembler code.

    2. Re:Pet peeve by someone1234 · · Score: 2, Informative

      I thought it compares implementations.
      If you look harder, you'll see multiple different implementations of the same language.

      --
      Patents Drive Free Software as Hurricanes Drive Construction Industry
    3. Re:Pet peeve by jilles · · Score: 3, Insightful

      Yes of course you are right. And more recently we actually have languages with coherent and consistent behavior across implementations (somewhat of a novelty, just look at C implementations). There's several Ruby interpreters that run the Rails framework now. The fastest one (or so it is claimed often) is JRuby, which runs on top of the Java virtual machine, which has has quite many implementations on a wide variety of hardware optimized for running on e.g. embedded hardware or on CPUs with thousands of cores and impressive levels of compatibility given these differences. So saying language X is faster than language Y is a quite meaningless statement these days. Faster on what, and under what conditions and at what required level of stability, and with what kind of benchmark? Most C programs are fast, except they have all but 1 core on the CPU idling because threading and concurrency are very hard to bolt on to a C program. Which is why some performance critical messaging servers are done in languages like Erlang.

      Most C programmers believe it is the closest thing to native aside from assembler. Probably correct if you ignore 40 years of progress in the hardware world but downright naive in light of modern day X86 processors. Technically x86 is not a native instruction set anymore but a virtual machine language that happens to have an in hardware translation to the 'real' instruction set. Like all such translations, it comes at a cost of lost flexibility, and indeed performance. But it is worth avoiding having to rewrite all those pesky compilers. So rather than shatter the assumptions C programmers make, they actually support them by sacrificing transistors. The only real difference between Java and C execution model (aside from better defined semantics in Java) is that Java does the translation in software, at run-time, taking into account performance characteristics of both the running program and the underlying hardware. That in a nutshell is why the LLVM project exists to do the same for C programs (and indeed many other languages, including Java).

      Of course you have to take into account the levels of abstraction and indirection provided in application frameworks as well. Those come at a cost and that cost is typically high in scripting languages (but you get so much in return). Java is often unfairly compared to C. I say unfairly here because it is usually a comparison of application frameworks rather than the language implementation. Java is in 'laboratory' conditions quite fast, even comparable to C and applies all the same performance optimizations (and then some). Except, nobody programs Java that way (except some dude at work who managed to produce the suckiest Java class ever, different story) . Similarly, C mostly lacks the rich frameworks that are common in the Java world. Transcode a C program to Java and you end up with a code base that is still pretty fast (e.g. quake 2 has a Java port). Stupid people in both camps believe that it is an either-or type decision between the two and that it is somehow inherent to the language what you end up with. Clever engineers know that 95% of their code is not performance critical at all (i.e. cpu idling most of the time), and that it makes a hell of a lot of sense to do whatever is necessary to get that 5% performing as best as possible if the cost in terms of stability, productivity, security, portability, etc is low enough. That's why server-side c is not a commonly required job skill.

      That's why Apple used the llvm platform to port Mac OS X to mobile phones and why Google chose to implement a heavily customized Java vm on top of familiar C/C++ components to emulate their success. Good engineers know when to choose what. Both iphone and android are excellent achievements that move beyond the stupid status quo of wondering which language is better.

      --

      Jilles
  8. Forth, the RPN notational programming language by RichMan · · Score: 4, Informative

    http://en.wikipedia.org/wiki/Forth_(programming_language)

    --
    Forth is a simple yet extensible language; its modularity and extensibility permit the writing of high-level programs such as CAD systems. However, extensibility also helps poor programmers to write incomprehensible code, which has given Forth a reputation as a "write-only language". Forth has been used successfully in large, complex projects, while applications developed by competent, disciplined professionals have proven to be easily maintained on evolving hardware platforms over decades of use
    --
    Forth is still used today in many embedded systems (small computerized devices) because of its portability, efficient memory use, short development time, and fast execution speed. It has been implemented efficiently on modern RISC processors, and processors that use Forth as machine language have been produced
    --

    1. Re:Forth, the RPN notational programming language by wonkavader · · Score: 2, Interesting

      If the code size attribute is measured in number of lines, I suspect that forth, which is practically an assembly language, will rank very low (near the top of the graph, if not at the very top), though it ought to be very fast (near the left). It depends so much on stack operations that I suspect its left to right ranking would depend a great deal on the processor it's running on.

      I love forth. I learned it many years ago. But I've never been in a position to use it for anything, which is a shame.

    2. Re:Forth, the RPN notational programming language by Richard+W.M.+Jones · · Score: 3, Interesting

      I wrote a little "literate" FORTH tutorial if any readers of the above comment are interested in it: jonesforth.

    3. Re:Forth, the RPN notational programming language by rbrander · · Score: 5, Insightful

      I fell hard for FORTH in the mid-80's - it was the programming language of some instrumentation I had to work with. I never did program the instrumentation, but got all the books on the language and interpreters/compilers (the distinction blurs in FORTH...) for it for a number of computers. I did some useful utilities for the PC using "HS/FORTH". I benchmarked it against some other solutions for a course in comparitive computer languages about 1985, and for heavily stack-based (ie very recursive) programs, nothing could touch it. I'm talking QuickSort faster than C.

      But I have to admit: though I busted butt, re-writing and re-re-writing programs to make them as clear and readable as possible, though I re-read the remarkable "Thinking FORTH" by Leo Brodie many times (and would recommend it to anybody who wants to understand the craft of programming, whether they want to learn FORTH or not)....despite it all, most of my FORTH programs were hard to read a few months later.

      There were things it was really good at - that is, the programs WERE readable later, the problem and language were a match - and others where I could just not seem to decompose the problem into FORTH words that fitted well together without a lot of "glue" to manipulate the parameters on the stack.

      That was the most frequent problem with my FORTH programming - one ends up trying to manage several parameters on the stack and doing a lot of stack "DUP SWAP ROTATE" - actions to line up the parameters to hand to the next word. I would re-compose the words and the parameters they wanted to clean up some code, and find I'd made some other code all hard to read.

      FORTH was also profoundly command-line oriented, and when the word went all GUI-centric on me with no good "Visual FORTH" or "Tk/FORTH" on the horizon, I slipped from grace. I can't see getting back to it now, either; lets face it, a huge bonus for any programming language choice is its popularity, so that others will maintain your code, so that you can get help and code fragments with a quick google.

      But I still think that FORTH should be a completely MANDATORY learning experience in all University and Tech CompSci degrees. You can jump from C to Perl to Python far more easily than to FORTH - it really comes at problems from another angle and working with it for years has been an enormous asset to my non-linear thinking when it comes to problem-solving.

      And perhaps if more students learned it, FORTH would rise in popularity for some problems, out of its decades-long sinecure in embedded systems (it started off programming radio telescopes, and undoubtedly still does...) Since it is inherently object-oriented (yes, an assembler-sized OO language from the 1970's, you heard that correctly) it would be an excellent interpretive, experimentation-friendly scripting language for applications. I'm currently needing to do a lot of VBA in Excel at work, and I have a strong suspicion I'd be twice as productive in "FORTH for Applications". It's a tragedy Bill Gates fell for BASIC (of all languages) instead.

    4. Re:Forth, the RPN notational programming language by skeeto · · Score: 2, Interesting

      If you like Forth, you should check out Factor, which is basically a modernized version of Forth (dynamically typed, no *very* low level filesystem junk that Forth has). I've recently started playing with it.

  9. Verbosity is bad because by Limerent+Oil · · Score: 3, Insightful

    Verbosity = ( 1 / Expressiveness )

    1. Re:Verbosity is bad because by Goaway · · Score: 4, Insightful

      Nowhere near true. Objective-C is more verbose than C, yet still more expressive, and largely self-documenting to boot.

  10. Where are the real lanaguages??? by jackb_guppy · · Score: 4, Interesting

    Where Cobol and RPG, the languages that run business?

    1. Re:Where are the real lanaguages??? by DoofusOfDeath · · Score: 5, Funny

      Where Cobol and RPG, the languages that run business?

      They were so far off the top and right axes, the algorithm discarded them as outliers.

    2. Re:Where are the real lanaguages??? by jd · · Score: 2, Funny

      They wrapped round. You have to turn the PNG over and look at the back.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  11. What kind of verbosity? by Timothy+Brownawell · · Score: 5, Interesting

    I think verbosity in moderation is necessary. I have read many an article with developers arguing that they don't need to document their code when their code is self-documenting. Do you make all of your variables and class/function/methods a single character for the sake of verbosity? I hope not. And I would think that reading and maintaining that code would be far less than a joy.

    Long meaningful identifiers are useful. Needing 5 lines of setup for each API call is annoying, particularly if those 5 lines are usually the same. Requiring lots of redundant long keywords to "look more like English" is annoying. Large standard libraries that let you remove most of the tedious parts from your code are useful.

    1. Re:What kind of verbosity? by Goaway · · Score: 2, Insightful

      Verbose standard libraries can help immensely with keeping code self-documenting.

    2. Re:What kind of verbosity? by ucblockhead · · Score: 5, Informative

      Exactly.  As an example:

      for item in list:
        print list

      for(object o in list) {
        Item item = (Item) o;
        System.Out.Println(item);
      }

      for(std::list<Item*> it=list.begin();it!=list.end();it++) {
         cout << (*it)->name << "\n";
      }

      Three languages.  Same identifiers.  Big difference in both verbosity and readability.

      --
      The cake is a pie
    3. Re:What kind of verbosity? by Anonymous Coward · · Score: 5, Funny

      And yet you managed to write buggy code in the most terse and readable of them. So much for dynamic languages.

    4. Re:What kind of verbosity? by ydrol · · Score: 2, Insightful

      for(object o in list) {
          Item item = (Item) o;
          System.Out.Println(item);
      }

      What language is this? If its Java maybe

      for(Item o : list) {
          System.Out.Println(o);
      }

      Although java 1.4 would have been more painful..

      http://leepoint.net/notes-java/flow/loops/foreach.html

      Also I guess there are times when strong typing is considered expressive and when it is considered overly verbose.
      In a large application, weak typing sometimes is a PITA, in a short script it is lovely.

    5. Re:What kind of verbosity? by ucblockhead · · Score: 2, Insightful

      One suspects I'd have found that bug pretty rapidly.

      If you can point me at a language that guarantees bug-free programs, I'd like to see it.

      --
      The cake is a pie
    6. Re:What kind of verbosity? by rrohbeck · · Score: 3, Insightful

      I prefer
      print foreach @list;
      though. Perl FTW as usual :)

    7. Re:What kind of verbosity? by setagllib · · Score: 2, Informative

      Scala, just as type-safe as C++ with good performance and excellent JVM integration:

      scala> val list = List(3, 4, 2, 1)
      list: List[Int] = List(3, 4, 2, 1)

      scala> list foreach println
      3
      4
      2
      1

      You know very well this is a big deal for the future of programming.

      --
      Sam ty sig.
    8. Re:What kind of verbosity? by helixcode123 · · Score: 2, Interesting

      Or just:
      print "@list";

      Perl. It puts the "fun" in your functions!

      --

      In a band? Use WheresTheGig for free.

    9. Re:What kind of verbosity? by Madsy · · Score: 2, Informative

      copy(alist.begin(), alist.end(), std::ostream_iterator(cout));
      Not to mention std::for_each and std::transform from .
      Probably just me, but I find your C++ example code slightly unfair.

  12. Ocaml by LaminatorX · · Score: 3, Interesting

    Every time I see one of these things, OCaml always rocks it. I wonder why it never caught on to a greater degree?

    1. Re:Ocaml by 16384 · · Score: 3, Insightful

      I don't about the rest of you, but functional languages don't fit my brain, and to me it's not worth the struggle. On the other hand, procedural/OO languages are no trouble at all, and I can learn new ones quickly. I don't understand why anyone would choose lisp, scheme, etc. Maybe they were born with bigger stacks, because when working with functional languages I'll go into stack overflow mode in a jiffy :-)

    2. Re:Ocaml by Daniel+Dvorkin · · Score: 3, Interesting

      I semi-agree -- procedural languages are much closer to the way most people think, and that's why pure functional languages have remained a niche. OTOH, the power and expressiveness of functional programming is really amazing. It seems to me that this is a major reason for Python's success: it's basically a procedural language (of which OO is a subset) that makes a functional style easily available.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    3. Re:Ocaml by Anonymous Coward · · Score: 4, Interesting

      To be honest, I have the same reaction. I love OCaml, and am frustrated by the fact it hasn't been adopted more. It seems like a no-brainer to me.

      I've been following it over time, and I think the reasons for it have become clearer to me.

      1. I think the biggest reason is hard to articulate well, but basically I think the OCaml developers are sort of unresponsive to the community, which has been embryonic as it is, and as a result there's a sense that it's not moving in directions it should be. Numerical applications, for example, are one domain where OCaml interest has really been high, but the developers have been pretty unresponsive to concerns about matrix implementations. Comments by the developers on concurrency have also puzzled a lot of people. I don't mean to sound like a troll, but I have gotten the sense over time that while OCaml is wonderful as it is, it's not changing or moving anywhere, at least as quickly as it should be (in a bad way). Haskell is a good comparison to me in this regard, as it's a language that is also functional, but not as useful in applications than it is theoretically. However, Haskell has a wonderfully strong community, it is almost a model of how a language and its implementations can grow in a productive way.

      2. OCaml is occupying a difficult position, in that people who want cold, hard performance with stable implementations will go somewhere else (e.g., C); people who want theoretically elegant implementations will go somewhere else (e.g., Lisp, haskell), and people who want something simple will go somewhere else still (e.g., Python, Ruby). OCaml in many ways occupies all three places, but not quite as well as any one of them.

      Having said all of that, it's important to keep in mind that Microsoft is sort of pushing F# for 2010. F# is essentially a Microsoft implementation of OCaml for the CLR--very very close to OCaml--so maybe if F# takes off, there will be a big push toward OCaml.

      It's one of the few times I could say that Microsoft is really on target technically, and might actually move the numerical computing field forward.

    4. Re:Ocaml by david.given · · Score: 3, Interesting

      A while back I tried implementing a project in OCaml, because it looked awesome, and I wanted to explore it.

      I found a lot to like about it; it's fast, reasonably clear, has got lots of awesome functional programming features that I actually found myself using while also having a powerful set of imperative programming features for the rest of the logic, and in general worked rather well.

      However, I kept finding myself running again and again into problems caused by the same conceptual design issue, which eventually led to me giving up in frustration.

      The problem was this: an OCaml program is structured as a series of statements, each of which mutates the program in some manner (usually by adding a definition to it). The last statement in the program typically invokes something (such as a 'main' function). The compiler ensures that your program is consistent after every statement. This means that you can't do forward declarations.

      There is an and construct that allows you to define several items of the same kind in a single statement, which is typically used to implement mutually recursive functions, but that doesn't help if you need to items of different kinds to be mutually recursive: for example, a class and an algebraic data type (which I needed to do lots, in order to implement 'object or None' semantics).

      I found this issue everywhere I looked in OCaml; the language semantics require your code dependency graph to be a tree with no cycles, and you have to structure your program strictly in bottom-up form. So not only can you not have two mutually dependent modules, you can't even put your 'main' at the top of the file for clarity.

      Now, my OCaml skills aren't particularly great, so there may be a way round this, but I spent a lot of time looking for a solution to this and didn't find one. This, and other lesser issues to do with code style and namespacing, smell unpleasantly like an academic language that hasn't really learnt to scale gracefully, and I wonder whether it would be a comfortable choice for implementing large projects. These days I'd be inclined to consider Haskell or Clean instead.

    5. Re:Ocaml by Coryoth · · Score: 2, Insightful

      It's closer to how people who have programmed in imperative/OO languages for many years think. Do you really think for example (python-ish metacode):

      res = emptylist()
      for i in aList:
              if (i.isFnord()):
                          res += i

      is simpler than (haskell-ish):

      filter isFnord aList

      I find it tends to be a case of exactly what you are trying to do. Some problems, such as filtering a list, tend to get expressed functionally (though I like python's list comprehension syntax "[i for i in aList if i.isFnord()]"), and the procedural approach looks and feels clunky by comparison. On the other hand there are other problems that are expressed naturally in a more procedural way (often because we think of them in terms of a logical sequence of state based steps) that take some work to wrap up in a functional way. I don't think it is clear that one approach is the right one for all problems, and personally I find I prefer languages that provide expressiveness in both approaches so I can use whatever is more clear.

  13. HAI by Anonymous Coward · · Score: 4, Funny

    CAN HAS LOLCODE?
    KTHXBYE

  14. Re:C best language out there by Anonymous Coward · · Score: 2, Funny

    It would be better if it was extended to support classes.

  15. Re:Where are the old standards? by mdmkolbe · · Score: 2, Informative

    ML, Haskell, Scheme, Fortran and Common Lisp are on the list. You probably didn't notice them because they are listed by their implementation name (e.g. mlton/O'Caml, GHC, Stalin/Gambit/Ikarus/Chicken, G95, SBCL/CMUCL, etc.). The Shootout front page lists which implementations implement which languages.

  16. I think it depends more on what you want to achiev by ledow · · Score: 5, Interesting

    This kind of fits in with my thinking.

    When I was starting out in programming, I just wanted results. I wasn't concerned about performance because the computer was a million times faster than me. I was most concerned about how many "non-vital" keywords were necessary to describe what I wanted the machine to do (e.g. "void main(...)" isn't *vital* because it's just boilerplate. However "if", "for", "while" etc. would be vital - and even for/while are just cousins), and how many of the vital keywords (i.e. those that specifically interfered with the way my program would *actually* operate... a "static" here or there would hardly matter in the course of most programs) were "obvious". Java failed miserably at this... I mean, come on: System.out.println() and the standard wrapping take up too much room.

    So, BASIC was an *ideal* first language (sorry, but it was, and the reason nobody uses it much now is because EVERYONE has used it and moved on to something else - doesn't mean it "breaks" people). In this regard, even things like C aren't too bad - 30-50 keywords / operators depending on the flavour, all quite simple - you could memorise them perfectly in an afternoon. However things like Forth and Perl can be hideous.

    And even C++ is tending towards the stupid. Believe it or not, even things like bash scripting come out quite well under that test. And, to me, that correlates with the amount of effort I have to put in to write in a particular language. If I just want to automate something, bash scripting is fast and easy. Most of the stuff I write is a "one-job program" that will never be reused. If I want to write a program to work something out or show somebody how something is done programmatically, BASIC is a *perfect* prototyping language (no standard boilerplate, no guessing obscure keywords, etc.). If I want to write a program that does things fast, or accurately, or precisely, or for something else to build upon, C is perfect.

    I see no real need to learn other languages in depth past what I'm required to know for my work. I have *zero* interest in spending weeks and weeks and weeks learning YAPL (Yet Another Programming Language) just to spent 90% of that time memorising obscure keywords, boilerplate and the language's shortcuts to things like vectors, string parsing, etc. If I was going to do that, I'd just learn a C library or similar.

    I think that these graphs correlate quite well with that thinking. Let's be honest, 99% of programming is reusing other code or shortcuts - short of programming in a Turing machine, C is one of the simplest languages to learn because it *doesn't* have a million shortcuts... you want to iterate over an array or create a hash / linked list, etc. you have to do it yourself from basic elements. In modern programming, that means a one line include of a well-written library. As far as I was concerned when learning it, even the "pointer++ increases by the size of the pointer" was far too smarty-pants for me, but incredibly useful.

    But with C++, I instantly lost interest because it's just too damn verbose to do a simple job. Java OOP is slightly better but still nasty once things get complicated and the underlying "functional" language is basically a C-a-like.

    I'm a fuddy-duddy. Old fashioned. If I write a program, the damn computer will damn well do instruction 1 followed by instruction 2 with the minimum of flying off into libraries and class systems. If I want 4 bytes of memory to change type, then I will damn well have them change type. And I'll even get to specify *what* 4 bytes of RAM if I want and I'll clean up after them if it's necessary. That's how I think, so things like C match perfectly when I want to code. The fact that C is damn powerful, fast, low-level and so common also add to it's appeal.

    I worry about what will happen when people *only* code in OOP languages. The abstraction is so large that people forget that they are still telling a computer to handle bits and bytes and suddenly they get lazy. M

  17. Ruby by RiotXIX · · Score: 4, Insightful

    On the plus side, both versions of Python can claim many of the smallest programs in the collection. Ruby (8, 1) might also compete for titles, but unfortunately its performance is so bad its star falls off the performance chart.

    Then why the fuck is the Ruby community hyping it so much, and drawing nieve young developers in to a trap?

    Not flamebait.

    Why can't they make a language, or extend a language like Ruby, such that one can program it as a scripting language, but then add verbosity optionally (i.e. declaring the data types and their sizes, private / static etc. & whatever the hell makes a program light weight and fast) optionally? It's my hope that if I stick with Ruby one day it I won't be forced to learn Python because performance won't be "Ruby's big issue" in every discussion, but really, that is *just* a hope. I hope this isn't a mistake.

    --
    "You know you don't act like a scientist, you're more like a game show host." Dana Barret
  18. Be aware of your contexts. by cabazorro · · Score: 2, Insightful

    Contexts can be deceiving.
    Be careful not to use these charts to decide what language to learn or what language is better for a given solution.
    Let's remember the web server ecosystems: cgi, c#, perl, java, python, php, ruby.
    A given algorithm implemented in you language of choice can give you the upper hand
    and instant notoriety; but running the whole operation (labor/maintenance/testing) goes far beyond
    controlled environment testing.

    Lately I've been thinking that
    the more powerful solution (language wise) is the one that you can build and tear down from scratch in less time/effort.
    That gives you more confidence to try new/innovative solutions.
    my 2 cents.

    --
    - these are not the droids you are looking for -
  19. ccomparison of C and CAS by e**(i+pi)-1 · · Score: 2, Insightful

    Computer algebra systems are high level programming language. Writing good code does not need
    documentation.  The code itself shows what is done. Here is an example which takes two pictures
    and procuces a GIF movie interpolating them:

    A=Import["image1.jpg"]; B=Import["image2.jpg"];
    width=Length[A[[1,1]]]; height=Length[A[[1]]];
    ImageInterpolate[t_]:=Image[(t A[[1]]+B[[1]] (1-t)),Byte,ColorSpace->RGB,ImageSize->{width,height}];
    Export["mix.gif",Table[ImageInterpolate[k/50],{k,0,50}],"GIF"]

    It takes over a minute to process. A simple C program doing the same is a multiple times larger but also
    needs multiple less time to process. But it needs to be documented because even simple things like
    reading in a picture

      fgets(buffer,1025,in);
      if(strncmp(buffer,"P6",2)){
        fprintf(stderr,"Unsupported file format (need PPM raw)\n");
        exit(1);
      }

      do fgets(buffer,1025,in); while(*buffer == '#');     // get picture dimension
      x_size = atoi(strtok(buffer," "));
      y_size = atoi(strtok(NULL," "));
      fgets(buffer,1025,in);                               // get color map size
      c_size = atoi(buffer);

      if((image = (char *) malloc(3*x_size*y_size*sizeof(char)))==NULL){
        fprintf(stderr,"Memory allocation error while loading picture\n");
        exit(1);
      }

      i = 0;
      ptr = image;
      while(!feof(in) && i<3*x_size*y_size){ *ptr++ = fgetc(in); i++;}
      fclose(in);

    But C it is worth the effort. For more advanced image manipulation tasks for example,
    Mathematica often can no more be used,  due to memory or just because it takes too long
    (Math link does not help here very much since objects like a movie (a vector of images) can just
    not be fed into computer algebra systems without getting into memory problems, which deals with a movie as a whole).
    For computer vision stuff for example, one needs to deal with large chunks of the entire movie).
    While the simplicity of programming with high level programming languages is compelling, speed often matters.

    There is an other nice benefit of a simple language like C: the code will work in 20 years. Computer algebra
    systems evolve very fast and much what is done today does not work tomorrow any more in a new version. Higher
    level languages evolve also faster. And large junks of internal CAS code are a "black box" invisible for the
    user. Both worlds makes sense: the low level primitive, transparent and fast low level language and the slower, but
    extremely elegant high level language.

  20. some random observations by bcrowell · · Score: 3, Interesting

    First off, he presents the big chart twice. The second version is meant to compare functional languages with imperative languages, but it's also small enough to fit on my screen, so if you're browsing the article, you might want to look at that one first.

    His "obsolete" sector is really more like a special-purpose sector. For instance, Erlang shows up in the obsolete sector, but that's because Erlang wasn't designed to be especially terse or fast. Erlang was designed to be fault-tolerant and automatically parallelizable. Io also ends up looking lousy, but Io also wast designed to be terse and fast; it was designed to be small and simple.

    The biggest surprise for me was the high performance of some of the implementations of functional programming languages, even in cases where the particular languages aren't generally known for being implementable in a very efficient way. Two of the best-performing languages are stalin (an implementation of scheme/lisp) and mlton (an implementation of ml). However, as the author notes, it's common to find that if you aren't sufficiently wizardly with fp techniques, you may write fp code that performs much, much worse than the optimal; that was my own experience with ocaml, for instance.

    The choice of a linear scale for performance can be a little misleading. For instance, csharp comes out looking like it's not such a great performer, and yet its performance is never worse than the best-performing language by more than a factor of 2 on any task. Typically, if two languages differ by only a factor of 2 in speed, then speed isn't an important factor for choosing between them. The real thing to look out for is that some of the languages seem to have performance that's a gazillion times worse than normal on certain specific tasks.

    Many of the languages are hard to find, because they're listed by the names of their implementations. In particular, g95 is an implementation of fortran.

  21. Re:Where's D? by wonkavader · · Score: 2, Informative

    Isn't that the 'dlang' reference?

  22. Re:Ada by Ada_Rules · · Score: 4, Informative

    Where's Ada?

    One item in the list is gnat which is one particular implementation of Ada. So, there is at least one Ada implementation on the list. I did not recognize any others.

    --
    --- Liberty in our Lifetime
  23. This is totaly stupid by FlyingGuy · · Score: 4, Interesting

    These sorts of things never fail to to amaze me.

    The verbs, nouns, semantics and such used in a given programming language have nothing, I repeat... NOTHING to do with performance!

    What does have to do with performance is the talent of the compiler / interpreter author, nothing more, nothing less.

    C implements ++ and so forth and so on. Pascal does not, you have to express it as var := var + x or in some implementations as inc(var) or inc(var,100). The smart compiler / interpreter author would implement those in the fastest possible way regardless of the particular language.

    The one metric that has real meaning is programmer enjoyment. Do you prefer terseness over verbosity or something in between. Does this languages flow amke you truly appreciate working with it.

    The only other real metric that has any true meaning is again the talent of the compiler / interpreter author. Was the the language parser built so that it can unfold complex statements that are often required to express certain ideas and perform certain operations. Does the language implement your favorite expression, eg: ++ , or something like that, which again harkens back to programmer enjoyment.

    So what it really leaves us with is, "Do you enjoy using that language?" and only you, the programmer can asnwer that question.

    --
    Hey KID! Yeah you, get the fuck off my lawn!
    1. Re:This is totaly stupid by Twylite · · Score: 2, Insightful

      The verbs, nouns, semantics and such used in a given programming language have nothing, I repeat... NOTHING to do with performance!

      What does have to do with performance is the talent of the compiler / interpreter author, nothing more, nothing less.

      The empirical evidence then tells us that the authors of assemblers are more talented than those of C compilers, who are in turn more talented that the authors of compilers/interpreters of JITs and dynamic languages. Put another way, you're wrong.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:This is totaly stupid by Kjella · · Score: 3, Interesting

      I don't think that's the primary scale. I think my primary scale is:

      What level of detail control is the programmer required to and permitted to have?
      How easy is it for a developer to shoot himself (or others) in the foot?
      How often must the developer work around poor or missing language features?

      For example, there's no lower level than assembly but it has no high-level features. Java is high level but has no low-level memory and byte manipulation to speak of. I prefer C++/Qt, I have all the practical high-level functions for the quick gains, yet I can down dive to detailed C/C++ management.

      In terms of "how easy is it to shoot himself in the foot?" I think C/C++ could do much better. Doing all sorts of pointer manipulation is error prone and zero-terminated char arrays are the thing of the devil. And while C++ has exceptions I've never seen them applied consistantly and well like in Java.

      Finally, I think there should only be the need for ONE standard library, not a five library mashup that's kinda standard. Everything else should be modules usually building on top of that library. Java, C# has done it - I emulate it with Qt in C++ because I think STL/boost/whatever is not very good.

      --
      Live today, because you never know what tomorrow brings
  24. Re:C best language out there by mdmkolbe · · Score: 3, Interesting

    Ha ha. Good joke. You've forgotten the most important feature "needed in a great programming lang": higher-order and first-class functions with proper closures. Oh wait, C doesn't have that.

    Any truly great statically typed language will also have at least algebraic data types, parametric polymorphism (even C++ only has ad-hoc polymorphism), type constructors and functions, maybe even a Turing complete type system (heh). C doesn't have any of those.

    Even aside from types, great languages should include tail-call optimization, pattern matching and hygienic macros (CPP macros are a bad joke).

    Now don't get me wrong. C is a great portable assembly language. It's close to the metal, widely known and easy to read. But as far as programming languages go, C feature poor.

  25. True but not very useful by rbarreira · · Score: 2, Insightful

    What does have to do with performance is the talent of the compiler / interpreter author, nothing more, nothing less.

    I think your statement is strictly speaking true but not useful in practice.

    Here's what I mean: strictly speaking, with unlimited intelligence on the compiler's part, the compiler can understand what a program does and rewrite it completely as it wishes to conform to the same behavior. This means any turing-complete language can have the same performance, with a sufficiently intelligent compiler

    In practice and in current times, however, a language's features determine how well the state-of-the-art in compilers can optimize a program. To give a very simple example... You don't see compilers inserting statements to free memory in Java programs, even though that would sometimes make them faster than running them with a garbage collector as happens in practice.

    --

    The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
  26. Re:I think it depends more on what you want to ach by gparent · · Score: 2, Informative

    It's *not* several layers of objects.

    System is the package containing the 'out' object, which is of type "PrintStream". println() is simply the method that outputs a line of text to the standard output, followed by a newline character for the current system.

    Now, compare this to C++: std:: is the namespace, which is the same as "System". However in C++, this code: "using std::cout;" will allow you to omit the name space when you use the object. "cout" is an object of type ostream, like "out" in Java. And then, "operator
    So in both languages, we're dealing with 3 different things: a namespace, an object, and a function call. Some people think C is better because you can just write printf(), but I disagree because I cringe whenever I need to type silly things with libraries such as BASS_DoThis(), BASS_DoThat(), etc. Namespaces are *way* better.

  27. island paradise by epine · · Score: 5, Insightful

    When the first 4K TRS-80 showed up at my high school, I had the option to learn BASIC, Z80 machine code, or APL up the street at the local university.

    One of my early exercises with BASIC was writing a set of nested for loops which called a subroutine (gosub). I put the next statement that controlled the for loop iteration inside the subroutine, and the return statement for the subroutine inside the nested for loops. It still worked! At that point I understood that there were mechanistic languages and languages with a solid conceptual basis.

    APL's reputation for inscrutability was only halfway deserved. Often the problems arose when you were trying to shoe-horn a data structure that didn't want to be an array into an array, because that was your only hammer. Later APL supported nested arrays, which increased the data structuring options, but I think by then the PR battle was lost.

    In the original APL, it was kind of painful to pass more than two arguments to an APL function. This lead to programmers passing in flags to the function encoded in the array's rank, which were extracted to the tune of rho rho rho, while imaging the knapsack folding problem in Colossal Cave Adventure. As brutal as any language I've used. But you have to give APL a bit of a pass in some respects. Like vi, it was designed in 1963 to work well within the constraints of a paper teletype.

    The next level of inscrutability arose because the APL primitives could often be combined in novel ways to yield surprisingly powerful algorithms. IIRC, the IBM 370 APL included a JIT compiler for certain common APL idioms. A one line program I wrote in APL to find primes (sieve of Eratosthenes) ran ten times faster than the compiled PASCAL program by the CS student sitting next to me.

    Understanding APL was a lot easier if you were familiar with functional programming languages, but these hadn't been invented yet. Hey, I didn't know this: the Wikipedia page credits APL as a direct influence on FP, which I first heard of in 1982. Father knows best.

    So you encounter this unfamiliar pattern of 15 familiar symbols for the first time, and you brain is polluted with horrible iterative solutions from BASIC or PASCAL, and the beauty of the expression is denied to your limited frame of consciousness.

    Like solving a Suduko? Hardly. It takes me twenty minutes to solve a typical five star Sudoku. It used to take me about the same amount of time to puzzle out an unfamiliar APL one liner, which might be anywhere from 10 to 40 characters. There is one small difference: after decoding the APL algorithm, I usually slapped myself across the head and moaned to myself, "I am unworthy to drool on the shoe laces of the grand designer, but I will learn!" Never got that feeling from Sudoku.

    Wrestling with the higher art of APL was like giving your ignorance a root canal. Sometimes the root canal made me barf up my milk: when the highest art of APL was applied to shoe horn a data structure unsuitable to array representation into an array representation anyway, like the Beethoven scene in Clockwork Orange.

    The third case is where the one liner isn't all that difficult, but it's doing it in more dimensions than the brain wishes to visualize. This is a case where a picture is worth a thousand words. Your 20 character APL function would have been better presented as a caption on a one page UML diagram. Never figured out how to embed a UML diagram in an APL lamp statement on my VT100 terminal.

    Another problem APL suffered was too much kinship with Forth. To thrive in APL, you needed to create hundreds of tiny APL functions, which the implementations of the day mashed together into a single unmaintainable workspace.

    And the system interface tended to suck.

    But other than that, what's not to like?

    I could have composed instead a tedious, but germane post on Shannon's first law: concision is a function of preconception. It's a rare breed of programmer who thrives in a language which provides su

    1. Re:island paradise by Anonymous Coward · · Score: 3, Insightful

      Lisp, arguably the grandfather of a lot of programming languages, was specified around 1958. While the first efficient implementations were a long time coming from that, I don't think you can claim APL was a forerunner to FP languages.

      Nice post otherwise :-)

    2. Re:island paradise by Kazoo+the+Clown · · Score: 2, Interesting

      Nice post. It is true that APL sends you to places you never go with any other language. And it is also true that this isn't necessarily a good thing.

      My first language was APL on an IBM System/360 in about 1973. I recall one of the lab assistants had a workspace of text functions he'd created that some of us were looking at. One in particular, was designed to take a text string and reduce occurances of multiple spaces down to single spaces. The program was a one-liner, of about 120 characters. Several of us looking at it could see that it could be simplified from this 120 character monstrosity, and of course that it *should* be, so we set ourselves to the task. We divided up into a few groups, and an buddy and I worked on it for awhile and got it down to 14 characters. We concluded that was as good as it could get and were firmly convinced we would win the informal contest we were having. But then one of the other students showed us his result which was almost identical to ours but had it at 13 characters because he had noticed a logical not that could be combined with an operator in order to eliminate it. We were crushed because we worked so hard on it and were sure we had it aced...

      But that was pretty typical with APL, you could spend a huge amount of time juggling array elements to be just so, in order to evaluate all the answers in parallel, when in any other language you would have just written a for loop with a few statements and been done with it. Not as challenging as APL, but as I said, that could very well be a Good Thing(TM)...

      Plus, the varying quality of APL programmers meant that you may be looking at a 120 character monstrosity of obscure and unneccessary logic that could have been done more concisely in 13 characters...

  28. A language does not have performance by brunes69 · · Score: 3, Insightful

    Performance is created by the compiler, not the language. A C program compiled with a shitty compiler is going to run slower than a Ruby one in a good VM, even though C is running native on the CPU. For that matter, what if I take the C code and compile it with the CLR as a VM target?

    I wish people would stop trying to compare languages by performance, it does not make any sense. The only language it makes any sense for at all is assembler.

  29. Writing APL by DrYak · · Score: 2, Funny

    If you would like APL to be on the list, then submit benchmarks for APL to the Shootout (the blog got its data fro there).

    ~I'm sure he would definitely like to. But he broke the necessary keyboard~

    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
  30. These benchmarks suck by coppro · · Score: 2, Insightful
    Okay, there's many problems with the benchmarks here, including in the labeling.
    • The uses of each language aren't analyzed. I've never encountered a desktop application written in Perl, nor have I ever seen a C++ web framework (I'm sure both exist, but they aren't common)
    • Dependability isn't analyzed. The title specifically says 'dependability'. I can excuse them because well-written Erlang smokes the competition in terms of reliability (Some Erlang-based servers have been running with 100% uptime for years).
    • This is not a comparison of multiple programming languages. It's a comparison of a haphazard set of environments. For instance, C and C++ are not distinguished, but the various compilers are. On the other hand, C# and F# are grouped the same, even though they operate in the same VM, with the same JIT optimizer, and so on (and Mono, on the other hand, is nowhere to be found.

    I'm sure there are others, but I have work to do.

    1. Re:These benchmarks suck by adamkennedy · · Score: 2, Interesting

      FYI, the new Padre Perl IDE is itself written in Perl.

      http://padre.perlide.org/wiki/Screenshots

  31. These benchmarks are bogus by atripp · · Score: 3, Informative

    All of these numbers are based on what completely flawed microbenchmarks from a site that used to be called "The Language Shootout". The numbers have been thoroughly debunked several times in the past. See this thread, for example: http://www.javalobby.org/java/forums/t86371.html?start=30 Or just google for "language shootout". It's not that the people who run this are just incompetent (making dumb mistakes like including JVM startup times). It's that they actively allow and even encourage cheating. For example, at least one of the "C" benchmarks actually uses hand-coded assembly (libgmp), and rather than stick to the obvious "program must be written in the language it's listed under" rule, the site maintainer suggests that the "Java" benchmark could be changed to also use assembly. This is all documented in the thread listed above. After several of these debunkings over the years, they had to change the name from "the language shootout" to something else, as any quick google will show that these benchmarks are completely bogus. Nothing to see here, move along.

  32. Whole program compilers by Estanislao+Mart�nez · · Score: 2, Interesting

    The biggest surprise for me was the high performance of some of the implementations of functional programming languages, even in cases where the particular languages aren't generally known for being implementable in a very efficient way. Two of the best-performing languages are stalin (an implementation of scheme/lisp) and mlton (an implementation of ml).

    You should not draw too many conclusions about the results of those two without taking into account the fact that both are whole-program optimizing compilers. Those two systems just do not support separate compilation of individual source files; if you change one line of one file in your program, every file must be recompiled.

    This type of compiler has a performance advantage over the more common separate compilation systems, simply because it can inline anything anywhere, and thus optimize far more aggressively. But it's next to useless for developing large software systems, and thus mostly really useful only for writing smallish programs, in very high-level style, that perform some really expensive computations really fast.

  33. Re:Servers are cheap and getting cheaper by Foofoobar · · Score: 3, Interesting

    Funny, isn't this what Twitter thought too before dumping RUBY entirely? Wasn't this what Twitter thought as they threw more and more hardware at the problem and still could not solve the problem? Didn't Twitter end up spending more on IT to administer 2-3 times the numbers of servers that it would take to do the same thing in Python, PHP or Java?

    Yeah, throw hardware at it. That's a viable solution for a company. As long as you aren't thinking about who has to maintain all those servers and the fact that RUBY STILL DOESN"T SCALE.

    --
    This is my sig. There are many like it but this one is mine.
  34. Re:Anti-functional FUD by ygslash · · Score: 2, Interesting

    If this were the case then Perl 6 would have stuck with the Pugs implementation.

    That's silly. Pugs was not designed as a production implementation of Perl 6 - it was a proof of concept for the new syntax. The fact that Pugs was so surprisingly easy to implement, and so surprisingly performant before any effort at all was put into its performance, was a stunning demonstration of the power of functional programming.

    GHC would have stuck with Darcs and not gone to GIT.

    GHC did stick with Darcs. There was a time when a move to Git was considered, but it had nothing to do with Darcs being written in a functional language. At the time, the Darcs team was not big enough or well enough organized to keep up with the heavy support demands of being the RCS for a large and growing compiler project. That has changed. Darcs has become one of the best run (and most fun) open source projects, with a large team of active and talented developers. Darcs is now an excellent choice of RCS even for very large projects.

    That is typical of the process that has been happening with functional programming during the past few years - a quick transition from the theoretical to the best-of-breed in practice.

    So if you want to continue this conversation start reading the various performance related discussions. There are 2 decades of papers on trying to resolve specific examples of this problem.

    If you're interested in history, you are the one who ought to have a good look at that literature. Learn to tell the difference between knotty problems that were identified twenty years ago, and the astonishing continuous progress that has been made since then.

    But if you want to continue this conversation, you should look at what is happening in the present. One thing that has happened is that you no longer need to read academic papers to learn and use functional languages in practice. There are books, online tutorials and resources, many developer-friendly tools, and a huge and super-friendly community.

    The shootout is a nice demonstration that speed optimization is another aspect of the increasing strength of modern functional compilers and functional programming techniques. No one will claim that a functional language can beat C at speed right now, but it says a lot that such high level languages can now compete well in the same league as C. As hardware architectures continue to move farther and farther away from the classical imperative model, watch for this trend to continue.

    I love functional languages but putting your head in the sand regarding where the problems are and considering the evaluations FUD is not going to advance the cause.

    I called the great-grandparent post FUD because it is FUD. These are common misconceptions, caused by lingering impressions of where functional programming was decades ago. Open your eyes, look at the facts, see what is happening now. Don't let the FUD lull you into apathy.