7 ms·
Call me old school, but I like looking at the number of lines of code to get a feel for how big of a project something is. Mako[1] is 265,618 lines of code. The
by cantrevealname 5y ago
Call me old school, but I like looking at the number of lines of code to get a feel for how big of a project something is. Mako[1] is 265,618 lines of code. The most widely accepted Bitcoin implementation[2] is 639,074 lines of code -- that's 2.5x bigger and written in a slew of languages. Mako looks like a super-impressive amount of work (and by a single person no less).
[1] https://github.com/chjj/mako https://github.com/chjj/mako
[2] https://github.com/bitcoin/bitcoin https://github.com/bitcoin/bitcoin
[3] How I calculated: find <source-directory> -type f | sed 's/.*/"&"/' | xargs wc -l
EDIT: Also of interest is this "from-scratch tour of Bitcoin in Python" that was discussed here on HN a few months ago: https://news.ycombinator.com/item?id=27593772 https://news.ycombinator.com/item?id=27593772
- oars 5y agoThis is a great discussion of how to count code lines of code. Thanks.
- b20000 5y agolast week i got attacked here on HN for suggesting it is not bad to stick to one language and get BETTER over time rather than screwing around with new languages and fads every year. i think this sort of project illustrates what i meant.
- rweichler 5y agoThx for [3]. I usually just do wc -l *.c */*.c */*/*.c */*/*/*.c */*/*/*/*.c */*/*/*/*/*.c */*/*/*/*/*/*.c
- marto1 5y agothis looks hilarious and I guess it works. nice one!
- parhamn 5y agoIn bash/zsh and many other shells '*/*.c' would be similar.
- kazinator 5y agoI don't think so. In Bash you can do this: bash$ shopt -s globstar Then you can use double star syntax like this: bash$ wc **/*.c The **/ will match any number of directory components, including zero; I think it's like *.c */*.c */*/*.c and so on, like what OP wrote. Somewhat sadly, the Glibc glob function does not have an equivalent GLOB_ option for this; it's just in Bash.
- rweichler 5y ago-bash: shopt: globstar: invalid shell option name
- kazinator 5y agoBash's NEWS file says that globstar was added between bash-3.2 and bash-4.0. In the git repo, there is a 2009-dated commit 3185942a5234e26ab13fa02f9c51d340cec514f8 where the material appears, as a snapshot import. Make sure you're using "shopt -s globstar" and not "shopt -o globstar".
- thangalin 5y agowc -l $(find . -type f -name "*.c")
- kazinator 5y agowc $(git ls-files '*.c') This avoids counting things like generated code that is not checked in (lex.yy.c, y.tab.c or what have you), and any local test code or other junk you have laying around in the tree.
- latchkey 5y agohttps://github.com/boyter/scc https://github.com/boyter/scc
- bluejekyll 5y agoTokei is my go to for counting lines of code in a project: https://github.com/XAMPPRocky/tokei https://github.com/XAMPPRocky/tokei