AcademySoftwareFoundation / AcademySoftwareFoundation/rez
implement comparison operators in version module
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 374
- Avg merge
- 9d 12h
- Merged PRs (30d)
- 5
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.
Contributor guide
Research direction
Start by locating the version module and identifying the classes whose non-lt/eq comparisons currently rely on total_ordering or lt. Implement the comparison operators explicitly, then verify that ordering behavior is unchanged and benchmark solver performance to assess the expected speed improvement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100