-1

In general, the more concise & flexible a language is the slower is the execution of programs written in this language. on the other side, the fast languages are mostly overly verbose, requiring you to write several lines just to output "hello world", which means harder development time and is more error prone.

so the question is, is there any measurement of the conciseness to speed ratio?. if yes, how is it called and where can I find some information about it. thanks.

note: one can create a language of single letter tokens, p h printing hello world, that's terseness. conciseness means -for our purpose- as defined here :

Giving a lot of information clearly and in a few words; brief but comprehensive

Philomath
  • 115

2 Answers2

7

You might be interested in shootout.alioth.debian.org, particularly the code/time shapes. The linked page plots speed vs. loc for some benchmarks in various programming languages.

From more-concise at page left to less-concise at the right, from slower at page top to faster at the bottom.

These scatter plots show the fastest programs contributed for each programming language implementation, measured on this computer -- so they don't show ↓ slower more-concise programs that still seem relatively fast.

These are not the only programs that could be written. These are not the only programming languages. These are not the only compilers and interpreters. These are not the only tasks that could be solved. These are just 10 tiny examples...

gnat
  • 20,543
  • 29
  • 115
  • 306
wvoq
  • 528
2

Although they don't directly address the question you asked, you might find the Stepanov benchmark somewhat interesting. It deals only with a single language (C++) and programming with differing levels of abstraction within that language. I'd guess the higher levels of abstraction fit more closely with your idea of "practically expressive".

It defines levels from 0 to 12, starting from essentially C-like code using hand-written loops operating on pointers, and progressing to pre-written algorithms operating on iterators, etc.)

At one time, it was common to see penalties on the order of 2:1 (sometimes even more) for the higher levels of abstraction, even though it was carefully designed so a compiler should have been capable of producing the same output for all cases.

With most modern compilers, that's exactly what you get. You need to increase the number of iterations to get meaningful results (e.g., changing ::iterations from 25000 to 500000). With that change, and a modern compiler with optimization enabled, you can pretty much count on a ratio of 1.0 for every level of abstraction it defines. Depending a bit on some luck, you might even see the higher abstraction levels executing minutely faster than the lower ones (I've seen it, though I'm pretty sure it wasn't meaningful).

While this doesn't directly address the question of one language versus another, it does hint at the idea that expressiveness doesn't have to carry a penalty. At the same time, it's probably worth adding that even the most abstract code in this benchmark is fairly verbose compared to, say, Perl.

Jerry Coffin
  • 44,795