Boost logo

Boost :

Subject: Re: [boost] [xpressive] Performance Tuning?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-07-20 18:42:27


On Mon, Jul 20, 2009 at 1:40 PM, Edward Grace<ej.grace_at_[hidden]> wrote:
>>>    chrono_start = chrono();
>>>    while ( double( chrono_wall() - chrono_wall_start ) <
>>> chrono_wall_scale*4.0);
>>>    chrono_end = chrono();
>>>
>>> I'm now doubly confused as it appears to be complaining about the return
>>> type of std::clock, (the default wall-clock timer).  Maybe I can get my
>>> hands on a windows machine and compiler tomorrow....
>>
>> Edward, just a compliment (for now): what you are doing is cool!
>> I'm starting to be an eager supporter.
>
> Always good to hear.... ;-)
>
> After a mammoth effort and much code rejigging I've got it to not only
> compile, but work on Windows with MSVC8!  In fairness to the MS compiler it
> did spot some subtle run-time errors that I was getting away with just fine
> with g++.   I've had to rip out parts that used my home brew
> striding_iterator since there's no way to avoid dereferencing one past the
> end of the end.
>
> Similarly I've had to give up on keeping all the time deltas as integer
> types in order to cope with the Windows .QuadPart approach.  If you refer
> back to the discussion I was having with OverminD1 (thanks a lot for your
> efforts) you'll see it was causing some grief when trying to compile on
> Windows.   As a consequence the timer appears to be less sensitive, so may
> not pick out differences < 0.5%, but frankly who cares? ;-)
>
> Anyhow, enough rambling:
>
>  http://tinyurl.com/km9xlh
>
> The new timing code (with a better PDF containing docs) is:
>
>  ejg-timer-0.0.3.tar.gz
>
> Those of you watching in black and white need to set up MSVC and compile
> example_timer.cpp.  Everyone watching in colour need only do the usual:
>
>  ./configure; make; make install
>
> voodo...
>
> The uint_parser example that utilises the above is:
>
>  ejg_uint_parser_0_0_3.cpp
>
> I wait with baited breath.

Two warnings, but compile is successful.

1>R:\Programming_Projects\Spirit_Price\ejg_uint_parser_timing\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\ejg_uint_parser_timing\other_includes\ejg/timer.cpp(558)
: see reference to function template instantiation
'ejg::timer_result_type
&ejg::generic_timer<ticks>::measure_execution_result<void(__cdecl
*)(void)>(_Operation,ejg::timer_result_type &)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=void (__cdecl *)(void)
1> ]
1> R:\Programming_Projects\Spirit_Price\ejg_uint_parser_timing\other_includes\ejg/timer.cpp(242)
: see reference to function template instantiation 'double
ejg::generic_timer<ticks>::measure_execution_time<void(__cdecl
*)(void)>(_Operation)' being compiled
1> with
1> [
1> ticks=ticks,
1> _Operation=void (__cdecl *)(void)
1> ]
1> .\ejg_uint_parser_0_0_3.cpp(154) : see reference to function
template instantiation 'void
ejg::generic_timer<ticks>::measure_percentage_speedup<void(__cdecl
*)(void),void(__cdecl *)(void)>(_OperationA,_OperationB,double
&,double &,double &)' being compiled
1> with
1> [
1> ticks=ticks,
1> _OperationA=void (__cdecl *)(void),
1> _OperationB=void (__cdecl *)(void)
1> ]
1>R:\Programming_Projects\Spirit_Price\ejg_uint_parser_timing\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\ejg_uint_parser_timing\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\ejg_uint_parser_timing\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\ejg_uint_parser_timing\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\ejg_uint_parser_timing\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> .\ejg_uint_parser_0_0_3.cpp(133) : see reference to class
template instantiation 'ejg::generic_timer<ticks>' being compiled
1> with
1> [
1> ticks=ticks
1> ]

Running the file gives:
initializing input strings...
Calibrating overhead...<Unhandled Exception>

So, debugging into it now reveals that the error happens on line 170
in timer.cpp, this function call:

      ejg::statistics::robust_linear_fit(xs.begin() , xs.begin() + n,
                                         ys.begin() , ys.begin() + n,
                                         tmp.begin(), tmp.begin() + n,
                                         intercept, slope, __);

The problem is that n==4, xs.size()==4, ys.size()==4, and
tmp.size()==0, thus it is trying to get an iterator 4 elements past
the end. I do not see where you can set tmp either, at the start of
the function you tmp.clear(), but then never touch it again, so of
course it is going to be a size of 0, does this function really work
in gcc, and if so how?


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