Boost logo

Boost :

Subject: Re: [boost] [xpressive] Performance Tuning?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-07-28 08:46:42


On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
>>> Yea, a lot more accurate, but still not good for direct comparison
>>> with other people like the ejg timer is, I shall make a modification
>>> with that next.  :)
>>>
>>
>> Ew!  Warnings from the ejg files.  My build log is even more polluted!
>>  ;-)
>
> Hey - it compiles - one step at a time!  ;-)
>
> Can you post the warnings?  Today's warnings are tomorrows errors! I will
> attack them and hopefully iron them out - I too like clean build logs.

Sure, let me separate yours out from that rather bloody massive
warning that the xpressive code generates:
1>r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(468)
: warning C4267: 'initializing' : conversion from 'size_t' to
'unsigned int', possible loss of data
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(558)
: see reference to function template instantiation
'ejg::timer_result_type
&ejg::generic_timer<ticks>::measure_execution_result<_Operation>(_Operation,ejg::timer_result_type
&)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,xpressive_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<xpressive_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(242)
: see reference to function template instantiation 'double
ejg::generic_timer<ticks>::measure_execution_time<_OperationB>(_Operation)'
being compiled
1> with
1> [
1> ticks=ticks,
1> _OperationB=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,xpressive_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<xpressive_parsing::parser>,boost::_bi::value<unsigned
int>>>,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,xpressive_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<xpressive_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1> r:\programming_projects\spirit_price\price_parsing\main.cpp(302)
: see reference to function template instantiation 'void
ejg::generic_timer<ticks>::measure_percentage_speedup<boost::_bi::bind_t<R,F,L>,boost::_bi::bind_t<R,double
(__cdecl *)(const std::string &,const testing::tests_type
&,Parser,unsigned
int),boost::_bi::list4<A1,A2,A3,A4>>>(_OperationA,_OperationB,double
&,double &,double &)' being compiled
1> with
1> [
1> ticks=ticks,
1> R=double,
1> F=double (__cdecl *)(const std::string &,const
testing::tests_type &,string_parsing::parser,unsigned int),
1> L=boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<string_parsing::parser>,boost::_bi::value<unsigned
int>>,
1> Parser=xpressive_parsing::parser,
1> A1=boost::_bi::value<const char *>,
1> A2=boost::_bi::value<testing::tests_type>,
1> A3=boost::_bi::value<xpressive_parsing::parser>,
1> A4=boost::_bi::value<unsigned int>,
1> _OperationA=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,string_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<string_parsing::parser>,boost::_bi::value<unsigned
int>>>,
1> _OperationB=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,xpressive_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<xpressive_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1>r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(468)
: warning C4267: 'initializing' : conversion from 'size_t' to
'unsigned int', possible loss of data
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(558)
: see reference to function template instantiation
'ejg::timer_result_type
&ejg::generic_timer<ticks>::measure_execution_result<_Operation>(_Operation,ejg::timer_result_type
&)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,string_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<string_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(249)
: see reference to function template instantiation 'double
ejg::generic_timer<ticks>::measure_execution_time<_OperationA>(_Operation)'
being compiled
1> with
1> [
1> ticks=ticks,
1> _OperationA=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,string_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<string_parsing::parser>,boost::_bi::value<unsigned
int>>>,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,string_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<string_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1>r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(468)
: warning C4267: 'initializing' : conversion from 'size_t' to
'unsigned int', possible loss of data
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(558)
: see reference to function template instantiation
'ejg::timer_result_type
&ejg::generic_timer<ticks>::measure_execution_result<_Operation>(_Operation,ejg::timer_result_type
&)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,spirit_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<spirit_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(249)
: see reference to function template instantiation 'double
ejg::generic_timer<ticks>::measure_execution_time<_OperationA>(_Operation)'
being compiled
1> with
1> [
1> ticks=ticks,
1> _OperationA=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,spirit_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<spirit_parsing::parser>,boost::_bi::value<unsigned
int>>>,
1> _Operation=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,spirit_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<spirit_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1> r:\programming_projects\spirit_price\price_parsing\main.cpp(309)
: see reference to function template instantiation 'void
ejg::generic_timer<ticks>::measure_percentage_speedup<boost::_bi::bind_t<R,F,L>,boost::_bi::bind_t<R,double
(__cdecl *)(const std::string &,const testing::tests_type
&,Parser,unsigned
int),boost::_bi::list4<A1,A2,A3,A4>>>(_OperationA,_OperationB,double
&,double &,double &)' being compiled
1> with
1> [
1> ticks=ticks,
1> R=double,
1> F=double (__cdecl *)(const std::string &,const
testing::tests_type &,spirit_parsing::parser,unsigned int),
1> L=boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<spirit_parsing::parser>,boost::_bi::value<unsigned
int>>,
1> Parser=xpressive_parsing::parser,
1> A1=boost::_bi::value<const char *>,
1> A2=boost::_bi::value<testing::tests_type>,
1> A3=boost::_bi::value<xpressive_parsing::parser>,
1> A4=boost::_bi::value<unsigned int>,
1> _OperationA=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,spirit_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<spirit_parsing::parser>,boost::_bi::value<unsigned
int>>>,
1> _OperationB=boost::_bi::bind_t<double,double (__cdecl
*)(const std::string &,const testing::tests_type
&,xpressive_parsing::parser,unsigned
int),boost::_bi::list4<boost::_bi::value<const char
*>,boost::_bi::value<testing::tests_type>,boost::_bi::value<xpressive_parsing::parser>,boost::_bi::value<unsigned
int>>>
1> ]
1>r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(468)
: warning C4267: 'initializing' : conversion from 'size_t' to
'unsigned int', possible loss of data
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(558)
: see reference to function template instantiation
'ejg::timer_result_type
&ejg::generic_timer<ticks>::measure_execution_result<_LARGE_INTEGER(__cdecl
*)(void)>(_Operation,ejg::timer_result_type &)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=_LARGE_INTEGER (__cdecl *)(void)
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(166)
: see reference to function template instantiation 'double
ejg::generic_timer<ticks>::measure_execution_time<_LARGE_INTEGER(__cdecl
*)(void)>(_Operation)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=_LARGE_INTEGER (__cdecl *)(void)
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(92)
: see reference to function template instantiation 'void
ejg::generic_timer<ticks>::measure_infinity_time<_LARGE_INTEGER(__cdecl
*)(void)>(_Operation,double &,double &,double &,size_t)' being
compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=_LARGE_INTEGER (__cdecl *)(void)
1> ]
1> r:\programming_projects\spirit_price\price_parsing\other_includes\ejg\timer.cpp(80)
: while compiling class template member function 'void
ejg::generic_timer<ticks>::calibrate_chrono_overhead(void)'
1> with
1> [
1> ticks=ticks
1> ]
1> r:\programming_projects\spirit_price\price_parsing\main.cpp(279)
: see reference to class template instantiation
'ejg::generic_timer<ticks>' being compiled
1> with
1> [
1> ticks=ticks
1> ]

On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
>> Made a version of it using the ejg timer now, hope I did it well
>> enough, mostly just a hack-in since the pre-existing system did not
>> fit it well, but it compiles and runs and its result is (due note, I
>> bumped down the default iterations from 100 to 1 so it actually
>> executes today):
>
> You should only need 1 call.  The timer code should work out how many
> iterations it needs in order to obtain a satisfactory answer. In fact, going
> crazy, you should be able to reliably measure the speedup of parsing a
> single character! ;-)

Which is how I understood it, which is why I turned it down to 1 iteration. :)

On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
>> Calibrating overhead......done
>> Timer overhead (t_c) ~= : 14.6667
>> Jitter               ~= : 0.633371
>
> If you're employing getticks from FFTW's cycle.h perhaps it's not returning
> actual clock ticks, (e.g. from a Pentium cycle counter).
>
> On my machine (Intel Core 2 - OS X) the timer overhead is ~109 ticks == 109
> clock cycles.

I am using the cycle.h file, and I am pretty sure it was...

On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
> Do you think the overhead of calling through boost::bind could be comparable
> to the length of time it takes to run the function?

No, I just tested, it is negligeable

On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
> I suggest something that simply iterates over the test data but does not
> check for correctness of parsing.  Although it won't make a fat lot of
> difference in this case at least it's then consistent - you're timing the
> parsers not the tests for equality. The correctness test could then be done
> later once the timings are complete.

I actually already did that, however I kept getting warnings about the
measure_percentage_speedup function not being able to do something
with the template arguments for the function calls, which were just
standard void(void) functions, confuzzling. May look at that later,
almost bed time.

On Tue, Jul 28, 2009 at 6:32 AM, Edward Grace<ej.grace_at_[hidden]> wrote:
> Does the size of the test data set matter?  In other words do you notice
> similar speedups if the test data will all fit in cache?

His input data is a very detailed test that tests just about every
possible input, which can have different speeds for different ones, so
I think it would be a good overall test to keep and parse all 147k
values, perhaps if there was some way to test them all individually
using ejg and get a nice report? ;-)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk