Martin Sebor wrote:
Andrew Black wrote:
Greetings all.
Part of the intent for subversion submits r379032 through r379035 (as
I understand them) was to address some of the slowness in the
stringstream operations that was detected by the previous benchmarking
run. With a fresh benchmark run, the following are the results I
get. Results are user times in seconds, found by taking the average
of 3 runs of 500000 itterations.
I also ran some simple benchmarks:
latest gcc
stdcxx 4.0.2
+---------------+-------+-------+
| default ctor | 1.00 | 1.22 |
| char* ctor | 1.00 | 1.59 |
| string ctor | 1.00 | 1.05 |
| insert char | 1.00 | .96 |
| insert char* | 1.00 | .56 |
| insert string | 1.00 | .53 |
| sputn | 1.00 | .47 |
+---------------+-------+-------+
Clearly there is still some room for improvement. I tweaked the
allocation policy used by stringbuf to double the size of the buffer
(rather than growing by a factor of 1.6 or so) but that didn't make
any difference (which should have been expected).
The last number is particularly puzzling because, AFAICT, xsputn()
(called by sputn) is optimal. I don't see a significant opportunity
for optimization there.
Martin