* a hash table implementation
* a reference-counted string type
* a generic interface for doing tree traversals of protobuf data
* the protobuf decoder itself (which implements the previous interface)
* all the code to load proto descriptors (including bootstrapping the first one,
which is necessary to load others)What can you do in 2k LOC of C?
11–20 of 110 posts
Re: What can you do in 2k LOC of C?
#12The fastest JSON parser that I know of is implemented in ~1800 lines of Objective-C: https://github.com/johnezang/JSONKit. Its about 2-3x faster than the yajl bindings for Objective-C are, in my testing.
Re: What can you do in 2k LOC of C?
#13Would compiling Lisp code count against the challenge's LOC limit?
Re: What can you do in 2k LOC of C?
#14How many of these 2K sections can you string together to make something of further use? (using another 2k section, of course)
Re: What can you do in 2k LOC of C?
#15Write a basic Lisp interpreter/compiler and write everything else in Lisp? :) Would compiling Lisp code count against the challenge's LOC limit?
* It depends on the Boehm garbage collector.
* (This is embarrassing.) It stopped working after some version bump of GCC, and the cause is not at all obvious to me. Since I don't Scheme much anymore I gave up.
http://wry.me/~darius/software/uts.tar.gz if anyone cares.
Re: What can you do in 2k LOC of C?
#16 $ git show e83c5163316f89bfbde7d9ab23ca2e25604af290 --stat
commit e83c5163316f89bfbde7d9ab23ca2e25604af290
Author: Linus Torvalds
Date: Thu Apr 7 15:13:13 2005 -0700
Initial revision of "git", the information manager from hell
Makefile | 40 +++++++++
README | 168 ++++++++++++++++++++++++++++++++++++
cache.h | 93 ++++++++++++++++++++
cat-file.c | 23 +++++
commit-tree.c | 172 +++++++++++++++++++++++++++++++++++++
init-db.c | 51 +++++++++++
read-cache.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
read-tree.c | 43 +++++++++
show-diff.c | 81 ++++++++++++++++++
update-cache.c | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++
write-tree.c | 66 ++++++++++++++
11 files changed, 1244 insertions(+), 0 deletions(-)
:-)Re: What can you do in 2k LOC of C?
#17Re: What can you do in 2k LOC of C?
#18Those questions are especially pertinent in C.
Re: What can you do in 2k LOC of C?
#19If you think about it for a second, you realize that TrueType rasterization can't be that hard because printers were doing it long ago on crappy little embedded processors, but the default is just to fall back on the big ugly library, and then wrap it and pretend it's not there. How about instead, just write some good code? This is why 'modern' software can still manage to bring a 3GHz quad-core to it's knees, IMHO
The improvement in hardware specs are so useful not only because it is faster, but also because we can do much more without having to care about the details. Writing tiny, efficient libraries is cool, but it takes a lot of time, everything else being equal, so if you can afford not doing it, you don't.
Re: What can you do in 2k LOC of C?
#20A JSON parser? Heck yes, even with the UTF-8 handling. It wouldn't even necessarily suck.