3 ms·
if (dbs_per_call > server.dbnum || timelimit_exit) dbs_per_call = server.dbnum; Based on http://download.redis.io/redis-stable/src/expire.c http://down
by ShroudedNight 8y ago
if (dbs_per_call > server.dbnum || timelimit_exit)
dbs_per_call = server.dbnum;
Based on http://download.redis.io/redis-stable/src/expire.c http://download.redis.io/redis-stable/src/expire.c :
- `server.dbnum` appears to be a global
- `timelimit_exit` is a function static, and appears to always be one of {0, 1}. It's not obvious to me that it would 'prefer' either value.
- `dbs_per_call` (along with `timelimit_exit`) is used as part of the termination condition for the induction variable.
I guess that that I don't find it too surprising (in retrospect) that this conditional is expensive. Although, I must admit that I would have suspected timelimit_exit as being the source of the latency.
I do find it interesting that branching on the value of server.dbnum is much slower than using the same value in an unconditional assignment, given that the result is presumably used shortly later in another conditional as part of the for loop.