5 ms·
What does it even mean for a language to be faster?
by sigjuice 5y ago
What does it even mean for a language to be faster?
- mottosso 5y agoThat the same logical steps expressed in one language results in less computation time spent - when compiled or interpreted - than when expressed in another language. Seems a resaonable question to ask, given there's more to a language than how you express things. Like toolchain, library availability and community.
- retrac 5y agoSame idea as comparing different compilers for the same language. Some algorithms can be expressed in some languages in an essentially identical way. For example, various sorting algorithms look pretty much the same in Fortran, Pascal and C. Only surface syntax differs. Assuming this is done fairly with each implementation being properly equivalent, it's a way to compare the speed of the languages, at least for that algorithm.
- fhd2 5y agoNot sure how technically accurate it is, but "language" usually implies more than just the syntax. I hear and say things like "compiled language", "interpreted language", "language VM", "garbage collected language", "dynamically typed language" and so on. Those things all say something about development speed and runtime speed.
- sigjuice 5y agoThe phrases "compiled language" and "interpreted language", despite their widespread use, are not particularly sound concepts. There are plenty of languages that have both compilers and interpreters.
- coldtea 5y agoA lot. Semantics that can be made fast (e.g. C vs Python) with little effort. (Some languages with bad semantics for that might still get fast, but the language itself isn't designed to help that. JS for example was made fast, but with tons of effort but with tons of money and man-centuries thrown in by Google, Apple, Mozilla, MS, not the kind of recources available to most languages. So, I'd call a language whose semantics afford optimization a fast language). Runtime complexity (e.g. "zero overhead" vs "lotsa overhead" features). Also, I find the "language vs compiler" dicthotomy pedantic and tedious. For most languages and most use cases, there's a single dominant canonical version, e.g. CPython, Matz's Ruby, Oracle's Java. Just because there are niche other implementations all 10 people use doesn't change the fact that 90% of users will be on the canonical implementation, and for them, THAT's synonymous with the language, not just some abstract spec.
- igouy 5y ago> … single dominant canonical version, e.g. CPython, Matz's Ruby… Matz's Ruby MRI? No — "Since Ruby 2.6 introduced MJIT in 2018, its performance greatly improved" https://www.ruby-lang.org/en/news/2021/11/09/ruby-3-1-0-preview1-released/ https://www.ruby-lang.org/en/news/2021/11/09/ruby-3-1-0-prev...
- User23 5y agoStrictly speaking it's meaningless, since a language is a set of syntax and semantics. Pragmatically though, when people talk about the speed of a language they actually mean the typical performance of processes defined by programs written in that language, which of course depends on the code generator and runtime, among other things. There's nothing stopping anyone from writing a fully standards compliant C interpreter that will have considerably slower process execution after all. In fact, a quick search shows that it's been done many times, for example this[1]. [1] https://github.com/jpoirier/picoc https://github.com/jpoirier/picoc
- igouy 5y agoMaybe we mean programs, not languages; maybe we mean programming language implementations, not languages — "How many times slower, the fastest benchmark programs for selected programming language implementations are, compared to the fastest written in any of the programming languages." https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...