Browse Source

very slight but noticable performance improvement

We avoid writing to "memory" just in order to check loop
termination condition. While this looks like it makes really
no difference, the profiler (valgrind's callgrind tool) tells it
actually does. Also, wallclock time taken by time is consistently
a bit lower than with the previous method. As it doesn't hurt
anything (in terms of more complex code or so), I think the
change is worth it.
pull/208/head
Rainer Gerhards 10 years ago
parent
commit
cccfaf444e
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      json_object.c

+ 1
- 1
json_object.c View File

@@ -110,7 +110,7 @@ static int json_escape_str(struct printbuf *pb, const char *str, int len)
{
int pos = 0, start_offset = 0;
unsigned char c;
while (len--)
while (pos < len)
{
c = str[pos];
switch(c)


Loading…
Cancel
Save