Closed Eh2406 closed 7 months ago
I tried this branch on a pathological test case and it reduced the time from 10s to 3.6s!
That is wonderful to hear! As soon as this gets a review, let's get this merged!
I rarely provide enough documentation or use good names for things. Always feel comfortable asking me to improve! Anything in particular you want me to clarify?
I think basically anywhere you're doing something unintuitive for performance reasons as outlined in your bullets in the pull request summary you'd benefit from adding a comment explaining what's going on e.g.
// We can conclude
e > i
and do not check again for perf
Here's a small dissertation. Let me know if any of it made sense.
If people think of improvements to the documentation I added, PR's are welcome. So I'm going to merge.
I got nerds not by https://github.com/zanieb/pubgrub/pull/6. Which points out that intersection is slower than it needs to be when the basic operations on version are expensive. Here's what I've come up with.
The ideas are:
next_if
andeq
keep track of which iter to advance directly.end
came from, and we know that for each iteratorstart < end
, check for validity before determiningstart
e > i
dev
zanieb/#6
this
I tested this synthetically by making a version that increasing a global counter every time
eq
/cmp
/clone
/drop
is called. This global counter goes up much (~30%) less after this PR. Even on our normal benchmarks, where these operations are very cheap (a handful of CPU cycles), we see improvements (although only a few percent).cc @konstin for real-world impact. cc @baszalmstra https://github.com/mamba-org/resolvo/issues/2#issuecomment-1744436726 I don't know if these are improvements you'd be interested in include in your copy of this type.