Here is problem.
In Windows, VC 8 (VS 2005)
I built library as Release Multithreaded,
Either library was improperly built or fastformat is too s:low. 10M repeats of CString::Format takes ~6.5 sec in 32bit non-unicode build, while fastformat is some 10.5 minutes:
That's because fmt() and write() append to the existing contents of the sink. So, in the statement
fastformat::fmt(sink,"{0}",am);
you're adding to a string each time, making a very large string: "354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000 … etc."
Try placing the sink within the scope of the statement and you'll find the timings will be around the same. Here's a timing program I just knocked up:
Here is problem.
In Windows, VC 8 (VS 2005)
I built library as Release Multithreaded,
Either library was improperly built or fastformat is too s:low. 10M repeats of CString::Format takes ~6.5 sec in 32bit non-unicode build, while fastformat is some 10.5 minutes:
That's because fmt() and write() append to the existing contents of the sink. So, in the statement
you're adding to a string each time, making a very large string: "354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000354300035430003543000 … etc."
Try placing the sink within the scope of the statement and you'll find the timings will be around the same. Here's a timing program I just knocked up:
The output is
So, in fact FastFormat is a little faster than CString::Format()
HTH
Matt
Trying again, to get the formatting correct:
Thank you,
I figured out it and was going to add comment about my mistake, but you already pointed that out.