RE: [Boost-Users] [BGL] Best way to abort an algorithm from withi n a visitor?
If efficiency is your goal, exceptions are not the answer. Just enabling exceptions at compile time makes a noticable performance hit. Actually throwing an exception can gobble up a 1000 cycles, give or take. That's per throw. If you catch and throw again, you'll pay again. Now if you've got more than a hundred or so entries left to go, exceptions really are the greener grass. What's wrong with 'return', perhaps along-side some sort of 'done' status variable? I'm only vaguely familiar with the vistor pattern, but these would seem to be the obvious choice. --Mark Storer Software Engineer Cardiff Software #include <disclaimer> typedef std::disclaimer<Cardiff> Discard;
Now if you've got more than a hundred or so entries left to go, exceptions really are the greener grass.
The size of the graph is not known a-priori (not at coding time anyway) but is likely to be quite large.
What's wrong with 'return', perhaps along-side some sort of 'done' status variable? I'm only vaguely familiar with the visitor pattern, but these would seem to be the obvious choice.
If efficiency is your goal, exceptions are not the answer. Just enabling exceptions at compile time makes a noticable performance hit. Actually throwing an exception can gobble up a 1000 cycles, give or take. That's
See my earlier reply. In this case I'm deriving my visitor from a base and
overriding "event" handlers that receive their marching orders via const
references and return void. So there's no way to affect feedback to the
algorithm's dispatcher without actually making modifications to the
algorithm code.
"Mark Storer"
throw. If you catch and throw again, you'll pay again.
Now if you've got more than a hundred or so entries left to go, exceptions really are the greener grass.
What's wrong with 'return', perhaps along-side some sort of 'done' status variable? I'm only vaguely familiar with the vistor pattern, but these would seem to be the obvious choice.
--Mark Storer Software Engineer Cardiff Software
#include <disclaimer> typedef std::disclaimer<Cardiff> Discard;
participants (2)
-
Chris Russell
-
Mark Storer