Boost logo

Boost Users :

Subject: [Boost-users] boost::graph, ref vs. copy during relaxation
From: Tristram Gräbener (tristramg_at_[hidden])
Date: 2012-08-27 05:06:28


Hello,

I use boost::graph and the Dijkstra algorithm.

My edge property is rather big (I store public transport timetables on them).

In the file boost/graph/relax.hpp, the property of an edge is copied :
W w_e = get(w, e);

As my properties are large, it yields some overhead.

I changed that line to
const W & w_e = get(w, e);

My benchmarks (on 1000 runs) went from 101 secs down to 87 (using GCC 4.6 -O3)

So my question is :
– would it hurt if it used const& instead of copy?
– am I not correctly using the lib? Maybe should I use an index on the
edge property and use a functor to get the data in the different
operations (edge_less, combine); but wouldn't it mean re-implementing
the properties?

Thank you for your help


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net