Skip to content

Commit 176005f

Browse files
author
michalbiesek
committed
Move setting s[initlen] to avoid cache miss
1 parent 53cc7e5 commit 176005f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/sds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ static sds _sdsnewlen(const void *init, size_t initlen, int on_dram) {
151151
break;
152152
}
153153
}
154+
s[initlen] = '\0';
154155
if (initlen && init)
155156
(sds_place == SDS_ON_DRAM) ? memcpy(s, init, initlen) : zmemcpy_pmem(s, init, initlen);
156-
s[initlen] = '\0';
157+
157158
return s;
158159
}
159160

0 commit comments

Comments
 (0)