Where's All the Code?
flak.tedunangst.com
flak.tedunangst.com
It's pretty cool how the author uses LLVM as an example of a big codebase, then uses "10X that" as the requirement for how many directories and so on to support.
It's at least somewhat obscure, in the sense that adding support for another language becomes quite involved.
It would be interesting to micro-bench this code against something more naïve that just strcmp()s the extension against a list of known strings, or something.
It's patently absurd. I also like the ATOMIC_RADD for populating the line count:
https://github.com/skeeto/scratch/blob/5129fd45153999924334c...
This entire program is too clever by half, while still not doing a "correct" source line count (it just counts new lines).
Could we describe “ideas” or “logical units” in some way? Or maybe just count the number of keywords and operators?
I find that “lines” is so popular but almost always misrepresents simple code as being more complex, and complex code as being simpler.
Of course, lines, like in this post, can be a perfectly helpful answer to a question if the question isn’t “where’s all the complexity?”
https://pragprog.com/titles/atcrime/your-code-as-a-crime-sce...
Fortunately, the word complexity was not used there, and it's nice to see if this subsystem, or protocol, or driver, etc takes two orders of magnitude more than the others.
You can try to measure Cyclomatic complexity, so that's more useful in practice.
And to make matters worse, we don't actually know how to calculate the true Kolmogorov complexity of anything because humans are notoriously bad at figuring out what "the smallest program" actually is, so it's a great device for reasoning about complexity, but it's a near useless device for determining actual complexity.
I find it a very elegant concept about complexity (even if not very practical), and wanted to share it regardless to be honest ;)
Programming does not need to involve itself with the hardware, that’s just a tool for evaluation. A program is an idea expressed in a language. It’s some formal statement of intent. Sometimes we can evaluate it to produce an output. Sometimes these statements are muddied by underlying representations.
The length of a declarative program seems a pretty good rough measure of complexity in the way you are talking about. Operational complexity of course, in the number of steps to actually evaluate it is a bit different, based on what you are using.
I spotted some stuff that hints at low level protocols as well (i2c f.e.), so probably its just a whole lot of work to support AMD graphics cards. Potentially they upstreamed a driver or something.
(not digital rights management)
Rather disappointing, but what are you gonna do? Make your own high-performance graphics hardware? No. AMD is the highest performance graphics hardware with open source driver on the planet by a wide margin. Compromises have to be made. Just accept that the hardware division gives you this crazy register address file and don't touch it.
all the code in /dev/pci/drm are modern graphics drivers. (DRM as in Direct Rendering Manager)
find dev arch kern uvm -type d | while read dn; do printf "$(find $dn -type f | xargs wc -l | awk 'END {print $1}')\t$(du -h $dn | awk 'END {print $1}')\t${dn}\n"; done
Just kidding, but for smaller repos it gets the job done! And it's easy to run anything on each individual dir and add it to the output on the fly.
paths() {
dir=`dirname $1`
while test "$dir" != '/' && test "$dir" != '.' ; do
echo $dir
dir=`dirname $dir`
done
}
find $dir -type f -not -path '*/.git/*' | while read file; do
cnt=`wc -l < $file`
for d in `paths $file`; do
printf "%s\t%s\n" $cnt "$d"
done
done | awk '{
hierarchy[ $2 ] += $1;
}
END {
for (dir in hierarchy) {
printf("%8d %s\n", hierarchy[dir], dir)
}
}' | sort -rn | head | sort -k 2Looks extremely cluttered to me... should be in a table, left side showing the file tree, middle showing LOC, right side showing storage.
ncdu itself can accept a json file in a specific format [1]. Perhaps it will be a good idea to add an option to export the data in this format?
> module humungus.tedunangst.com/r/watc
Implies a “go get” should pick it up. Likely a git clone of that URL would do.
Second paragraph.
hg clone https://humungus.tedunangst.com/r/watc