Richard Bucker

The Really Big O

Posted at — Jun 21, 2011

Get your mind(s) out of the gutter. I’m actually thinking about benchmarks not bed-marks.Back in the olden days we used to refer to a program or algorithm’s performance profile in terms of o-notiation. I’m pretty sure that most computer scientists still follow this montra and for the most part it’s probably still true.So if it is the case that o-notation is still a real form of measure then why do most languages have different performance profiles while they perform the same work. For example 100K compares is the same when it all boils down to the assembly instruction that makes the decision:CMP AX, BXJE #SAME_VALUEWhen it comes down to it every language makes decisions the same way. So why such different profiles. I say again.First of all I think that the trouble lies in the libraries. I’m not convinced that the same care id put into every library so that the minimal number of instructions is executed. The reality is… how much code needs to execute on either side of the instruction above to actually do the work in the target language?Secondly not all JITs are equal. And while that’s good for som languages you’d think that at some point they’d all use the same JIT. But then I’d be complaining about benevolent dictators like Oracle. I really do not like the JDK being used for Scala, Clojure and others. While they are bolted on nicely… They simply inherit everything from the JDK and whatever Java libraries you care to use. As evidenced by Lift. Which seems to depend heavily on Jetty. And if the purpose of the language is to get the benefits of a functional language… using Java libs directly would seem to defeat the purpose.Finally whatever you are trying to accomplish in a single transaction is not unlike the CMP above. The number of comparisons over the transaction is no different between the many language. So whichever language you select it should have more to do with the overal impedance with the problem scope instead of the lonely intellectual islands.