3 ms·
The stats are misleading, as it's not a comparable rewrite. The new code is refactored and much cleaner. For example, for "LAN Resolver 105 vs 427" a 75% saving
by vicaya 17y ago
The stats are misleading, as it's not a comparable rewrite. The new code is refactored and much cleaner. For example, for "LAN Resolver 105 vs 427" a 75% saving. I looked at the actual code (thanks for posting it.) The C++ code contains a lot of cruft like explicit handling of ping/pong/pang and a http handler with some html snippets, which the new code doesn't have. I removed the cruft and result sloc is 105 vs 302 (still include all the boilerplate stuff: includes/namespace, the quite verbose asio server setup that can be refactored, and the line wasteful brace usage.)
The erlang code is also much denser. I gziped the code to compare a fairer symbol count: it's 1535b vs 2916b, a 47% saving, not bad but not that impressive either, considering the refactoring in the new code.
From user's point of view, the new distribution is 4x larger (10MB vs 2.5MB) and uses much more memory, which is a bad deal. It's OK for a developer to scratch his itch but dramatizing the benefit of such scratch doesn't help anybody.
- evgen 17y agoWhen the developer claims that Erlang only uses "slightly" more memory and is currently not optimized for efficient memory use how exactly do you get to "uses much more memory"? The difference between 10M and 2.5M for the distro size is so slight given current average broadband speeds as to not even be worth mentioning.
- dunk010 17y ago"not bad but not that impressive either". I think the 75% is accurate, but even at 50% it's impressive. The number of lines of code in an application makes a big difference to understanding the code and maintaining it. Erlang is just a much more modern language which benefits from having idioms which simply don't exist in c++. Another big win is erlang's message passing model which is much easier to grok and far less bug prone than threads.
- metabrew 17y agoI'm a bit late to the discussion on HN, but I responded in comments to the article stating that I removed the ping/pong code before running sloccount for the lan plugin. Even so, the c++ style means there will have been a slight linecount inflation.