Merge pull request #299 from qlyoung/perf-improvements

Improve json_object -> string performance
This commit is contained in:
Eric Haszlakiewicz
2017-02-04 11:13:14 -05:00
committed by GitHub
4 changed files with 85 additions and 34 deletions

View File

@@ -106,8 +106,15 @@ static void test_printbuf_memappend(int *before_resize)
printf("Append to just after resize: %d, [%s]\n", printbuf_length(pb), pb->buf);
free(data);
printbuf_free(pb);
#define SA_TEST_STR "XXXXXXXXXXXXXXXX"
pb = printbuf_new();
printbuf_strappend(pb, SA_TEST_STR);
printf("Buffer size after printbuf_strappend(): %d, [%s]\n", printbuf_length(pb), pb->buf);
printbuf_free(pb);
#undef SA_TEST_STR
printf("%s: end test\n", __func__);
}

View File

@@ -18,6 +18,7 @@ Partial append: 3, [blu]
With embedded \0 character: 4, [ab]
Append to just before resize: 31, [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
Append to just after resize: 32, [XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX]
Buffer size after printbuf_strappend(): 16, [XXXXXXXXXXXXXXXX]
test_printbuf_memappend: end test
========================================
test_sprintbuf: starting test