Possible improvement in next_permutation implementation

Paolo Carlini pcarlini@suse.de
Fri Mar 7 13:05:00 GMT 2008


David GONZALEZ MALINE wrote:
> I wonder whether it would be possible to make an implementation of the
> standard library method closer to what the gsl algorithm does. The
> three algorithms are intrinsically the same one, but the way they have
> been implemented differ in the small details, and that is what makes
> the difference in time.
I'm still checking a few things and performing microbenchmarks, but
apparently the performance gap is due to the fact that
std::next_permutation works with generic bidirectional iterators (i.e,
in the implementation we lack an overload optimized for random access
iterators).

Paolo.



More information about the Libstdc++ mailing list