Live data from Hacker News

A quick look at the Redis source code

heychinaski.com

11–20 of 34 posts

Re: A quick look at the Redis source code

#11
post #8

Redis is my favorite example of a very clean and beautiful example of C code, just the right amount of comments, good variable names. It is great work. You can tell Salvatore cares and has passion for what he does just by looking at his work. https://github.com/antirez/redis/tree/unstable/src

Wow it's awesome, comparing to the most of the C code that I saw it's beautiful. I like the long method names, because I can actually understand what they are doing.

Re: A quick look at the Redis source code

#12
post #2

It's actually a quick tutorial describing how to add a new command to Redis, not an actual analysis of the source code as I expected.

Yeah, it's a pretty shallow introduction. I'd like to write more articles on the Redis code. The sorted set skiplist stuff is really interesting.

The entire implementation of sorted sets is really interesting, with a dual implementation of ziplists and skiplists being used depending on the amount of elements in the list. I've been meaning to write bit more about Redis internals lately; maybe I'll start on that in my commute hours.

I've got a couple of general articles on adding a command and adding a datatype to Redis at http://starkiller.net, but I don't get too into existing code. I'd be interested in writing a bit more about the other data structures as well as the multiple strategies used for EXPIRE (which recently changed I believe).

Re: A quick look at the Redis source code

#13
post #11
post #8

Redis is my favorite example of a very clean and beautiful example of C code, just the right amount of comments, good variable names. It is great work. You can tell Salvatore cares and has passion for what he does just by looking at his work. https://github.com/antirez/redis/tree/unstable/src

Wow it's awesome, comparing to the most of the C code that I saw it's beautiful. I like the long method names, because I can actually understand what they are doing.

Maybe you haven't looked very often but nice code is out there for quite some time. Take a look at anything related to the GNOME stack (GLib, GTK+, all the applications) or the Linux kernel for example. And quite frankly, I stumble upon badly written Python way more often than C.

Re: A quick look at the Redis source code

#14
Nice post. I've been working quite a lot with the internals of Redis in the past few months. Adding custom commands along with the usual skimming through the builtins. Perhaps I should give people some insight by creating a few blog post as well. It's a really nice piece of software and written in clean, high quality, C. Not sure about the tests in Tcl though :).

Re: A quick look at the Redis source code

#15
post #6
post #2

It's actually a quick tutorial describing how to add a new command to Redis, not an actual analysis of the source code as I expected.

You might be interested in one of these articles: http://pauladamsmith.com/articles/redis-under-the-hood.html http://blog.togo.io/how-to/adding-interval-sets-to-redis They have both been discussed before though.

Ah yes, I remember the interval sets article. The first post is a lot more in depth than mine. Both great links, thanks.

Re: A quick look at the Redis source code

#17
post #11

Earlier quoted context omitted.

Wow it's awesome, comparing to the most of the C code that I saw it's beautiful. I like the long method names, because I can actually understand what they are doing.

Maybe you haven't looked very often but nice code is out there for quite some time. Take a look at anything related to the GNOME stack (GLib, GTK+, all the applications) or the Linux kernel for example. And quite frankly, I stumble upon badly written Python way more often than C.

The code for those might be great, but Redis is beautiful inside and outside. I'm not a fan of the actual output of the GNOME stack. I agree the Linux kernel code is generally great to read and to use.

Re: A quick look at the Redis source code

#18
post #11

Earlier quoted context omitted.

Wow it's awesome, comparing to the most of the C code that I saw it's beautiful. I like the long method names, because I can actually understand what they are doing.

Maybe you haven't looked very often but nice code is out there for quite some time. Take a look at anything related to the GNOME stack (GLib, GTK+, all the applications) or the Linux kernel for example. And quite frankly, I stumble upon badly written Python way more often than C.

IMO, OpenBSD and tarsnap are other notable samples of clean C code.

Re: A quick look at the Redis source code

#19
post #18

Earlier quoted context omitted.

Maybe you haven't looked very often but nice code is out there for quite some time. Take a look at anything related to the GNOME stack (GLib, GTK+, all the applications) or the Linux kernel for example. And quite frankly, I stumble upon badly written Python way more often than C.

IMO, OpenBSD and tarsnap are other notable samples of clean C code.

I'd also mention FreeBSD kernel and Niels Provos' code.
Post reply on HN