antirez/redis — pull request #285 by pietern (2012-01-03 06:26:21+00:00)
Title: Encode small hashes with a ziplist

This patch switches the encoding of small hashes from zipmap to ziplist (continuation of issue #188). This is a first stab, and it may need more work: tests pass, but I haven't done performance testing (throughput, memory). Because the vanilla ziplist API is used, which doesn't provide a function to *replace* an element, HSET is implemented as a delete followed by a push. This causes the fields in the ziplist encoded hash to be ordered by modification time (I see this more as a by-effect than a feature).

I haven't tested the loading of a zipmap encoded hash from an older RDB yet. We may want to add an integration test for that (i.e. one that includes a prefabricated RDB with such a key).