4 ms·
Actually, the python version has about 328 lines of code, while the scala version has about 216 lines of code. You should visit the Google project page and use
by Spyro7 15y ago
Actually, the python version has about 328 lines of code, while the scala version has about 216 lines of code. You should visit the Google project page and use something like cloc to analyze the files:
http://code.google.com/p/multi-language-bench/ http://code.google.com/p/multi-language-bench/
http://cloc.sourceforge.net/ http://cloc.sourceforge.net/
I confess that I do not know a lot about Scala, but it looks like some of the functional aspects of the language allow for some savings in lines of code.
If I had the time right now, I doubt that it would be too difficult to shrink the python version a bit. Just taking a glance at it, I don't see a single list comprehension throughout their code. I am sure there are some other language features that could probably have been better leveraged as well.
Just out of curiosity, where did you get the 626 loc and the 297 loc from - I tried looking but I can't find it anywhere. Though that could just be a product of my lack of sleep right now.
- cygwin98 15y agoThe 297 loc for scala pro is from the paper that also includes 13 lines of Apache license stuff on the top and 14 lines of comments. The author used "wc -l" to count the LOC, that's not very scientific anyway. The 626 loc for python is also from "wc -l". I looked at the code again and found out it contains a lot of detailed comments and even test cases, so it's not fair to say the python version has 626 loc. I suspect the author gives it out as a reference implementation.