gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] gnash ChangeLog server/as_value.cpp server/fill...


From: Benjamin Wolsey
Subject: Re: [Gnash-commit] gnash ChangeLog server/as_value.cpp server/fill...
Date: Tue, 20 May 2008 15:39:05 +0200

> Question: boost::format  is not dependent on any external binary
> library, right?
> 
Yes, boost::format is header-only.

> boost::format was mainly used for logging and debugging, that's fine
> to me, as the speed there is not very important.  But I also heard
> boost::format is about 10 ~20 times slower than sprintf(not tested).
> If it is true, then we may want to keep some 'snprintf' related
> functions in our AS interpreter.
> 
It is indeed much slower than printf - boost docs give the following
data:

- release mode :
printf                 : 2.13
nullStream             : 3.43,  = 1.61033 * printf
boost::format copied   : 6.77,  = 3.1784  * printf ,  = 1.97376 *
nullStream
boost::format straight :10.67,  = 5.00939 * printf ,  = 3.11079 *
nullStream

- debug mode :
printf                 : 2.12
nullStream             : 3.69,  = 1.74057 * printf
boost::format copied   :10.02,  = 4.72642 * printf ,  = 2.71545 *
nullStream
boost::format straight :17.03,  = 8.03302 * printf ,  = 4.61518 *
nullStream

(compiled with gcc 3.3.3, see
http://www.boost.org/doc/libs/1_35_0/libs/format/doc/format.html#performance 
for more details)

So in our case about 5 times slower than printf unless compiler
performance has improved (not impossible). I'm sure you're right that
it's potentially a bad idea to use this in parts of the code where
bottlenecks can occur. In this case to_debug_string(), as its name
suggests, should only be used for logging, so shouldn't have significant
extra cost when there's no logging output. The greatest impact would be
when running with -va.

I'm trying not to sacrifice performance when cleaning up code, even
while attempting to replace as many non-standard functions as possible,
so I'm grateful to anyone who keeps an eye on the changes.

bwy

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]