4 ms·
Is the github language summary indicative of relative LoC between implementations, or are there other factors? C++ 24.9% Python 19.5% Rust 12.5% PHP 9
by detrites 4y ago
Is the github language summary indicative of relative LoC between implementations, or are there other factors?
C++ 24.9%
Python 19.5%
Rust 12.5%
PHP 9.5%
Zig 9.4%
Nim 8.0%
Other 16.2%
And very interesting! Would love to read (a post?) on how you saw the language differences.
- shhsshs 4y agoYou would probably need a much larger sample set to give a "true" indication of relative LoC between different languages. Right now it's probably a good indicator of relative LoC between languages when writing a Game Boy emulator.
- vageli 4y agoAt least for the python percentage, it is skewed as both `py` and `pxd` contain python code.
- Shish2k 4y agoC++ and Rust contain (incomplete attempts at) emulating the sound chip - the other languages just have an empty stub (I want to get at least one implementation working properly before using it as a reference to write the others - interestingly both of those implementations, despite being written based on the same specs, sound wrong for different reasons…) Also I wonder how it counts “lines” - if it is literal newline characters, then probably the biggest factor there is that some languages insist on having a newline after each case in a switch statement and some don’t — so in the CPU implementation some languages are like case 0x42: self.PC = self.A; break; and others are like case 0x42: self.PC = self.A; break; (which adds up quite a bit when multiplied by 500 CPU instructions) If somebody wanted to go to the effort of counting logical statements per language, I’d be interested in seeing what that looks like :) It’s also probably worth comparing module-by-module — like for all languages, the CPU implementation does pretty much exactly the same thing in exactly the same way; but for command line argument parsing, every language is very different.
- Shish2k 4y agoTo speak entirely subjectively, nearly all of the languages felt like I was writing approximately the same amount of code - the only exceptions being C++ (where I needed to keep switching between .cpp and .h files and manually keeping them in sync, which felt like maybe 20% mental overhead), and Go (writing `if err != nil { return err }` after every line of code became very annoying very quickly, feeling like I was writing twice as many lines of code - and I still managed to forget to do error handling in a couple of places where it actually mattered, since it only forces you to handle `err` if you’re also handling some other return value...)