An earlier round of profiling showed that viewtopic.php spends a lot of time calling append_sid() This function has been optimized which made quite a difference but a new profiling run shows that still a lot of time is spent in append_sid().
Most of these calls are in a loop which results in several hundreds of append_sid() calls while only a single post/user ID is changed in these calls. I've replaced the calls to append_sid() with a simple str_replace which results in a 20% reduction in CPU time.
Patch can be found here:
And has also been attached to this issue.
A quick test by Paul shows that sprintf() is a bit faster than str_replace after all:
[13:50:17] <paul|laptop> 1000x str_replace: 0.00122087001801 milliseconden
[13:50:17] <paul|laptop> 1000x sprintf: 0.000857497215271 milliseconden