zlacker

[parent] [thread] 4 comments
1. akkart+(OP)[view] [source] 2018-11-13 03:38:42
Interesting to think what a different conclusion the article would have arrived at if he'd chosen to look at GNU cat on Linux. A few sample points:

* 2002: 833 LoC (http://landley.net/aboriginal/history.html)

* 2013: 36kLoC, 2/3rds of them .h files (https://news.ycombinator.com/item?id=11340510#11341175)

* 2018: 37kLoC of .c file dependencies going into libcoreutils.a and some LoC of .h files (coreutils has 60kLoC of .h files)

The methodology for counting lines likely isn't consistent across those data points. But the trend is still unmistakeable. Maybe I'll tree-shake all the dead code out and come up with an accurate line count one of these days..

replies(2): >>armini+ED >>akkart+nE1
2. armini+ED[view] [source] 2018-11-13 13:37:05
>>akkart+(OP)
This is why I think the movement of the future will be about going back and stripping cruft out of old codebases. We've seen the weaknesses of the bazaar/ many eyes, and the main one IMHO is code complexity, which is often easiest to measure in loc.
3. akkart+nE1[view] [source] 2018-11-13 20:41:34
>>akkart+(OP)
I just performed an ad hoc file-level tree-shaking for 'src/cat.c' in GNU coreutils 8.30, starting with `gcc src/cat.c` and gradually adding arguments until I got it to build. Here's the command I ended up with.

    gcc -I. -I./lib /
      src/version.c /
      lib/progname.c /
      lib/safe-read.c /
      lib/safe-write.c /
      lib/quotearg.c /
      lib/xmalloc.c /
      lib/localcharset.c /
      lib/c-strcasecmp.c /
      lib/mbrtowc.c /
      lib/xalloc-die.c /
      lib/c-ctype.c /
      lib/hard-locale.c /
      lib/exitfail.c /
      lib/closeout.c /
      lib/close-stream.c /
      lib/fclose.c /
      lib/fflush.c /
      lib/fseeko.c /
      lib/version-etc.c /
      lib/xbinary-io.c /
      lib/version-etc-fsf.c /
      lib/binary-io.c /
      lib/fadvise.c /
      lib/full-write.c /
      src/cat.c
Those .c files add up to 5021 lines.

The .c files include 44 header files:

    lib/binary-io.h
    lib/c-ctype.h
    lib/closeout.h
    lib/close-stream.h
    lib/config.h
    lib/c-strcaseeq.h
    lib/c-strcase.h
    lib/ctype.h
    lib/error.h
    lib/exitfail.h
    lib/fadvise.h
    lib/fcntl.h
    lib/fpending.h
    lib/freading.h
    lib/full-write.h
    lib/gettext.h
    lib/hard-locale.h
    lib/ignore-value.h
    lib/limits.h
    lib/localcharset.h
    lib/locale.h
    lib/minmax.h
    lib/progname.h
    lib/quotearg.h
    lib/quote.h
    lib/safe-read.h
    lib/stdio.h
    lib/stdio-impl.h
    lib/stdlib.h
    lib/string.h
    lib/sys/ioctl.h
    lib/sys-limits.h
    lib/sys/types.h
    lib/unistd.h
    lib/unused-parameter.h
    lib/verify.h
    lib/version-etc.h
    lib/wchar.h
    lib/wctype.h
    lib/xalloc.h
    lib/xbinary-io.h
    src/die.h
    src/ioblksize.h
    src/system.h
The header files add up to 19.7k lines.

So the total line count for files GNU cat actually needs to build is at least ~25k.

(I didn't bother checking for headers including other headers.)

Next step: do this for various versions of GNU coreutils.

replies(2): >>rain1+j32 >>rurban+GA2
◧◩
4. rain1+j32[view] [source] [discussion] 2018-11-14 00:28:56
>>akkart+nE1
Thanks for taking the time to do this counting, very interesting result.
◧◩
5. rurban+GA2[view] [source] [discussion] 2018-11-14 08:00:06
>>akkart+nE1
Much more code for much less functionality than the BSD cat which can do sockets. Not surprised at all.
[go to top]