Re: [Quickfix-developers] Details for Solaris / SunPRO 5.3 build
Brought to you by:
orenmnero
From: Caleb E. <cal...@gm...> - 2004-07-13 21:01:56
|
On Tue, 13 Jul 2004 13:54:50 -0500, Oren Miller <or...@qu...> wrote: > I noticed you replaced some sprintf calls with ostringstreams. We > actually used to do this, but performance testing revealed that the > sprintf calls were considerably faster. I don't remember the exact > numbers, but I believe using the sprintf calls made message > construction something on the order of 10% faster. That's pretty > significant. Is there a particular reason you changed these? On Linux I've definitely found this to be the case. Using sprintf to do the formatting and just sending char*'s to the iostreams is considerably faster. You can optimize even further by collecting the return value of sprintf and using ostream::write (const char*, streamsize) instead of ostream::operator<<, which will avoid at least a strlen call. Taken together, I think these will give you a good deal more than a 10% performance improvement. I think there is some additional optimization that could be done inside the QF Field class by reserving an appropriate amount of storage for m_data in the setString method before assigning to it. We have found std::string::append to be a bottleneck when doing this sort of thing on Linux. It would have to be a bit of a guesstimate though, since you don't know the number of digits in the ASCII representation of the tag. -- Caleb Epstein cal...@gm... |