Skip to content

implement comparison operators in version module #719

Open
@nerdvegas

Description

Currently, all non-lt/eq ops in classes in the version module, are implemented in terms of lt (this is a hangover from using the total_ordering decorator). It would be more optimal to implement each op explicitly instead. Even if the improvement is marginal, the solver spend a lot of time in this code, so it's probably worth doing.

From https://docs.python.org/3/library/functools.html:

While this decorator makes it easy to create well behaved totally ordered types, it does come at the cost of slower execution and more complex stack traces for the derived comparison methods. If performance benchmarking indicates this is a bottleneck for a given application, implementing all six rich comparison methods instead is likely to provide an easy speed boost.

For context, solves spend ~85% of their time in version code, and iirc a lot of that is in the comparison ops.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions