in reply to Re^3: Partial Order
in thread Partial Order
Yes, I know how much you like theory and abstractions, but I also know how slow they can be.
As for efficiency of the compare() sub.. I doubt mine is insanely slow. At worst, the calls to $g->has_edge would cost a few hash lookups in the internals of Graph. If optimization really is a concern at such a low level...From the original post, I had focused on "I need to implement a fast compare..." and, more importantly, "I need to do millions of comparisons..." With function calls being notriously slow in perl, adding 1 or 2 more to compare() is bound to be slower not faster which is what I believe the OP is after.
I follow everything you write very closely and in private conversations I have expressed my interest in you writing a tutorial to graph theory as a means to problem solving. I think your abstraction could still be very useful as a means for making the code more elegant provided there is a straight forward way to convert the resulting graph back into the HoH (for fast lookups).
Cheers - L~R
|
|---|