HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
cgag
loc
Rust2016–2024
cgag / loc

loc

Count lines of code quickly.

4Distinct people
6Mentions
0Explicit recommenders
2.5KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Count lines of code quickly.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year6 dated mentions

Observed mentions: 2016-10-25 15:10:45 UTC to 2024-07-29 01:31:26 UTC.

01232016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC312
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC110
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101

What Hacker News says

6 sources
More lines of code usually indicates more bugs so its not an entirely useless metric. Using it to gauge employee productivity is, since as the linked suggests some of the better programmers are able to remove code, which often reduces the potential for bugs. I personally find some use it in, if nothing else to identify which files probably need to be refactored as they are too large, or complex. Throw in some cyclomatic complexity and you are getting some useful information out the code counts. Counting lines of code is one metric though. Another I have seen thrown around is ULOC https://cmcenroe.me/2018/12/14/uloc.html where you count the number of unique lines of code, sort -u *.h *.c | wc -l Again another metric that potentially speaks to the health of a project. I personally wrote about this some time ago when someone asked why I
Read the rest
wrote a code counting project https://boyter.org/posts/why-count-lines-of-code/ and I liked the idea of ULOC so much I integrated it into the project as well. Clearly I am not alone in this though, hence there being so many code counters around (forgive me if I missed yours in the following list) and discussion around it. - [SLOCCount](https://www.dwheeler.com/sloccount/) the original sloc counter - [cloc](https://github.com/AlDanial/cloc), inspired by SLOCCount; implemented in Perl for portability - [gocloc](https://github.com/hhatto/gocloc) a sloc counter in Go inspired by tokei - [loc](https://github.com/cgag/loc) rust implementation similar to tokei but often faster - [loccount](https://gitlab.com/esr/loccount) Go implementation written and maintained by ESR - [ployglot](https://github.com/vmchale/polyglot) ATS sloc counter - [tokei](https://github.com/XAMPPRocky/tokei) fast, accurate and written in rust - [sloc](https://github.com/flosse/sloc) coffeescript code counter - [scc](https://github.com/boyter/scc) my own counter Incidentally the articles author confused me for a while using standard unix tools to count code, as I had them confused for David Wheeler who wrote the very first code counter that I know of sloccount.
In Counting Lines of Code
So I have to wonder about the performance difference between his sloccount and loc (https://github.com/cgag/loc) which is so fast it always makes me think that it hasn't done anything (same as ripgrep). I'm like 98% sure loc will be faster, but it would be interesting to know by how much.
In Grappling with Go

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.