loading...

Code counter comparison

yujiri8 profile image Ryan Westlund ・2 min read

Today I discovered loc, which I instantly knew would replace cloc for me as it's written in Rust instead of Perl (certainly a better language for the job, and I'd say a better language in general). 100x performance gain is a huge deal for a tool like this.

But I also learned of tokei. The loc README says loc is much faster than even tokei, but less accurate. But then tokei also seems to support more languages, so I'm not sure which I'll end up switching to.

But then I also found scc, a Go implementation that aims specifically at performance above all, and claims to be even faster than either of the Rust ones.

However, such a small performance gap isn't very important to me, and I don't have a very high opinion of Go, so I would still be opting for a Rust implementation in order to promote Rust.

But scc has some other features. Here's an output for the sway codebase:

───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
C                          221     42832     4857      1350    36625       8700
C Header                    57      4680      970       624     3086          0
Markdown                    17      1269      397         0      872          0
Meson                       10       720       57         3      660         38
SVG                          5       340        0         5      335          0
XML                          4       555       81         2      472          0
YAML                         4       111        1         2      108          0
Fish                         3        66        5         4       57          3
License                      2       140       15         0      125          0
Python                       2       194       38        13      143         43
Shell                        2       168       16        15      137         23
Autoconf                     1       217       24       109       84          1
gitignore                    1        13        0         0       13          0
───────────────────────────────────────────────────────────────────────────────
Total                      329     51305     6461      2127    42717       8808
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop $1,392,278
Estimated Schedule Effort 17.398295 months
Estimated People Required 9.479252
───────────────────────────────────────────────────────────────────────────────
Processed 1566503 bytes, 1.567 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

A complexity measurement? That sounds really cool!

Well, at least the idea of it does. In reality though, I have no idea how that measurement works or how much weight it deserves.

So I don't know. Which tool do you prefer?

Posted on by:

yujiri8 profile

Ryan Westlund

@yujiri8

I'm a programmer, writer, and philosopher. My Github account is yujiri8; all my content besides code is at yujiri.xyz.

Discussion

markdown guide