Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve searchsorted_interval performance #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aplavin
Copy link
Contributor

@aplavin aplavin commented Oct 16, 2024

Kinda hard to make a simple self-contained measurement that shows the performance increase: standalone searchsorted_interval calls remain the same with or without this PR. But this change does manifest itself in more complex scenarios: in particular, I found that it eliminates extra allocations in FlexiJoins.jl joins. Both on 1.10 and 1.11!
This would enable me to bump IntervalSets compat in FlexiJoins: now, it's restricted to <= 0.7.7 because of the searchsorted_interval regression afterwards (JuliaAPlavin/FlexiJoins.jl#10).

Supersedes #168, and relevant for both 1.10 and 1.11.
Basically, here we reduce the number and depth of kwargs calls – Julia doesn't seem to like them :) Order.ord is a public and documented function, even though it's rarely used explicitly:

help?> Base.Order.ord
  ord(lt, by, rev::Union{Bool, Nothing}, order::Ordering=Forward)

  Construct an Ordering object from the same arguments used by sort!. Elements are first transformed by the function by (which may be identity) and are then compared according to either the function lt or an
  existing ordering order. lt should be isless or a function that obeys the same rules as the lt parameter of sort!. Finally, the resulting order is reversed if rev=true.

  Passing an lt other than isless along with an order other than Base.Order.Forward or Base.Order.Reverse is not permitted, otherwise all options are independent and can be used together in all possible
  combinations.

julia> Base.ispublic(Base.Order, :ord)
true

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.84%. Comparing base (13c76e1) to head (ef2f742).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   99.11%   98.84%   -0.27%     
==========================================
  Files           6        6              
  Lines         225      260      +35     
==========================================
+ Hits          223      257      +34     
- Misses          2        3       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aplavin
Copy link
Contributor Author

aplavin commented Oct 16, 2024

Have no idea about the invalidations CI failure, is that action maintained at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant