4 ms·
Here's a better gauge for code density: https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html https://benchmarksgame-team.
by so-cal-schemer 8mo ago
Here's a better gauge for code density:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/how-programs-are-measured.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
How source-code size is measured
We start with the source-code markup you can see, remove comments, remove duplicate whitespace characters, and then apply minimum GZip compression. The measurement is the size in bytes of that GZip compressed source-code file.
Thanks to Brian Hurt for the idea of using size of compressed source-code instead of lines of code.
median
February 2025
===============
Toit 558
Perl 570
Lua 580
PHP 581
Ruby 583
Python 3 585
Julia 634
Chapel 646
Racket 696
JavaScript 698
OCaml 741
Erlang 798
Go 831
Dart 847
Smalltalk 871
Haskell 892
Java 910
Lisp 938
Swift 939
F# 943
Pascal 959
Fortran 1091
C# 1117
C 1121
C++ 1129
Rust 1235
Ada 1825
- mrsmrtss 8mo agoThe Benchmarks Game has some highly optimized implementations and is not a good representation of typical code. Some languages allow you to go a lot lower than others if needed, which adds verbosity, that does not mean typical code must be verbose. There are things possible in C# that you just can't do in Java, for example. That does not mean typical Java code is more concise than C#. On the contrary, typical C# would be probably considerably more "dense".
- so-cal-schemer 8mo agoGood points. There is a trade-off. Outside hotspots, readability / maintainability should take precedence.
- so-cal-schemer 8mo agoI dislike the short windows for editing / deletion. I could have just agreed and left it at that.
- igouy 8mo agoAnd yet, it may still be "a better gauge for code density".
- igouy 8mo ago> … is not a good representation of typical code. afaict that's unknown and "typical" weasel word and median.