In our upcoming MariaDB 5.3 release Monty optimized the internal string append code for performance. I tested his patch with a plain MariaDB 5.2 vs. a patched MariaDB 5.2 with sql-bench, which showed an overall performance gain around 3%.
The details of the patch Monty describes like this
Patch to optimize string append:
While examining a trace output from a mysql-test-run case, I noticed a
lot of reallocation calls. This was strange as MariaDB/MySQL was
designed to do so few malloc/realloc as possible. The system uses was
to first calculate how big buffer you would need and then allocate a
buffer big enough for most usage. …