From: Rob Stewart (stewart_at_[hidden])
Date: 2005-08-06 07:53:04
> Rob Stewart wrote:
> >From: FlSt_at_[hidden]
> >>Furthermore I uploaded a new implementation of my junctions calss to the
> >>sanbox file vault junction/boost_junction_v8.zip and a draft of a
> >I just tried that version tonight. So far, it has taken well
> >over 30 minutes to compile junction_example.cpp, and it's still
It took just over 39 minutes to complete.
> On my Pentium III 900Mhz (512 MB) (I know this machine is outdated like
> my gcc 2.95) it takes 15Minutes with g++ 4.0.1 and the compilation
> never finished with g++ 3.3.6 and 2.95.?, because my virtual memory was
> full ;-). I uploaded a new version to the sandbox file vault
> (junctions/boost_junction_v9.zip). This version compiles a little bit
> faster, but it's still slow. I don't know exactly why, but I think this
> has todo with the many operator template instances are generated with my
My test program instantiates many templates, too.
> test program. I removed the xxx_of functions for STL-Iterators, because
> Ranges of STL-Iterators can be generated with make_iterator_range(
> begin, end ).
I haven't looked at supporting pairs of iterators yet. You're
right that one can use make_iterator_range, but if we can use a
pair right out of the box, all the better.
> >I'll try rewriting my test program to work with your library so
> >we can compare them a little more fairly. I'll let you know what
> >I find.
> Good idea.
After removing all references to each_of, which I implemented, I
found that you hold the ranges by value. That's unnecessarily
expensive. I changed your *junction classes to hold references
to const instead. That permitted it to work with the arrays I
was using in my tests. With that change, the program compiled in
very short order and all tests passed.
I switched back to your test program and it again took a very
long time to compile. When I ran it, it dumped core due to what
looks like infinite recursion (SIGSEGV).
I took another look at your test program and I see that you run
756 test cases. My test program doesn't test n_of or n_m_of, and
you don't have each_of, resulting in a net of 248 tests. I would
not expect two orders of magnitude difference in compilation time
due to that, however.
I'll expand my test program to use std::sets and std::vectors
instead of just arrays of ints. Perhaps that will shed some
light on the difference. I will also add direct iterator
BTW, you should consider writing your tests such that you don't
have to visually inspect each test each run to decide whether
you're getting the correct answer. Do you save a vetted copy of
the output and diff the output of a new run against that each
Also, you should not put your code directly into namespace boost.
Following Boost guidelines, you'd create a "junctions" namespace
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;