from Hacker News

Sloc Cloc and Code – What Happened on the Way to Faster Cloc

by msangi on 6/4/18, 9:48 PM with 22 comments

  • by boyter on 6/4/18, 10:44 PM

    Nice to see this hitting the front page. None of my submissions of it ever did. Happy to answer any questions about it here should they come up.

    Certainly the biggest thing I took away from this was that the GC in Go is a far larger overhead than you would think, even for something that runs in 30ms.

  • by fouc on 6/5/18, 3:43 AM

    I was reading this and I was wondering that perhaps it would be better define a line as "80 characters of code", and measure by characters, then divide by 80 to get lines of code.

    The whole point of measuring lines of code is to get some sense of the complexity of the code base, but if what if one code base has lots of short lines, and another code base has lots of long lines. How would this be resolved?

  • by superdimwit on 6/5/18, 10:52 AM

    Could you try and reorder the state checks to occur with decreasing state-transition probability? I.e. if I am currently in code, it is most likely that I will be in code next state as well, a bit less likely that I'll be in a single line comment, and even less likely that I'll be in a multiline comment. If I'm in a multiline comment, I will most likely be in a multiline comment next, or code, but unlikely to be in a single line comment.

    Amongst a few equiprobable state transitions, ordering the checks by increasing expense might also help.

  • by llogiq on 6/5/18, 11:04 AM

    One thing the linked ripgrep post doesn't tell you is that line counting is also done with SIMD since it started using bytecount (https://github.com/llogiq/bytecount) some months ago, which sped up some workloads with line numbers considerably.
  • by merb on 6/5/18, 9:04 AM

    well the cost estimate is a little bit funny. Probably inaccurate :D

    > Estimated Schedule Effort 25.879043 months

    > Estimated People Required 18.118657

    Well I'm working alone on the project for 4 years...