3 ms·
Appending to a string buffer that grows exponentially will copy roughly twice as many bytes as building the result in a buffer that has the exact size. If you h
by bonzini 6y ago
Appending to a string buffer that grows exponentially will copy roughly twice as many bytes as building the result in a buffer that has the exact size. If you have to copy out of the resizable buffer into an exact-size area of memory, that becomes three times.
- kd5bjo 6y agoAlso, once your buffer exceeds the virtual memory page size, those copies turn into page table updates that never touch the string data.