mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 00:50:50 +00:00
If a float can be casted to a long long without rounding loss, we can use the integer conversion function to write the score on disk. This is a seriuous speedup
This commit is contained in:
parent
418807d2d5
commit
8c096b16a1
5
redis.c
5
redis.c
@ -3513,7 +3513,10 @@ static int rdbSaveDoubleValue(FILE *fp, double val) {
|
||||
len = 1;
|
||||
buf[0] = (val < 0) ? 255 : 254;
|
||||
} else {
|
||||
snprintf((char*)buf+1,sizeof(buf)-1,"%.17g",val);
|
||||
if (val == ((long long)val))
|
||||
ll2string((char*)buf+1,sizeof(buf),(long long)val);
|
||||
else
|
||||
snprintf((char*)buf+1,sizeof(buf)-1,"%.17g",val);
|
||||
buf[0] = strlen((char*)buf+1);
|
||||
len = buf[0]+1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user