antirez/redis — pull request #1719 by hanael80 (2014-05-04 15:23:35+00:00)
Title: Reduce rdb loading time

when saving rdb, save db dict size also.
when loading rdb, load db dict size and expand db dict with this dict
size value.
so avoid several db dict table expansion & rehash while loading datas.
because of rdb file compatibility, added new rdb opcode RDB_OPCODE_DB_DICT_SIZE

test result
data count : 9,463,389 (with 'set' command only)
rdb file size : 312,382,550 bytes
1. before.
average loading time : 9.924 seconds
table expansion count : 23
#log
expand: 4
expand: 8
expand: 16
expand: 32
expand: 64
expand: 128
expand: 256
expand: 512
expand: 1024
expand: 2048
expand: 4096
expand: 8192
expand: 16384
expand: 32768
expand: 65536
expand: 131072
expand: 262144
expand: 524288
expand: 1048576
expand: 2097152
expand: 4194304
expand: 8388608
expand: 16777216

2. after
average loading time : 6.998 seconds. (29.4% reduction)
table expansion count : 1
#log
expand: 16777216