Wednesday, September 10, 2008

FastFormat is FAST: It's official!

I just posted some performance stats on the FastFormat website. I'll just give you the summary here:
  • The Format API is faster than IOStreams by between ~140-730%, faster than MFC's CString::Format() by between ~300-400%, and faster than Boost.Format by between ~470-1600%! The only formatting API that gives it a run for some architecture/compiler/configurations is sprintf(), which is not type-safe, at between ~40-380%. (FastFormat's Format API is 100% type-safe.)
  • The simpler Write API is faster than IOStreams by between ~270-1350%, faster than MFC's CString::Format() by around ~420%, and faster than Boost.Format by between ~630-1800%! Again, the only formatting API that gives it a run for some architecture/compiler/configurations is sprintf(), at between ~65-390%. (FastFormat's Write API is 100% type-safe.)

4 comments:

Сергей said...

well, as usual no source code repository? ;)

Matt Wilson said...

Not yet, alas. But it's only in beta.

It'll end up in SVN before it is released properly.

Unknown said...

What code do you use for IOstream formating?

Is it something like this ?

stringstream s
s << "The first param '"
<< arg0
<< "', and the second '"
<< arg1
<< "', and the first again '"
<< arg0
<< "'. Finally, the third'"
<< arg2 << "'";

Because this is not the same functionality as there is no way to translate the format string if other languages change order of parameters.

Any insight ?

Matt Wilson said...

You're quite right. That's one of the points of FastFormat: the IOStreams, as well as being very slow and not type-safe, don't support I18N/L10N.

Matt

FYI: The code for the perf test is included in the distro.