IntervalSets.jl icon indicating copy to clipboard operation
IntervalSets.jl copied to clipboard

improve searchsorted_interval performance

Open aplavin opened this issue 1 year ago • 2 comments

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 (https://github.com/JuliaAPlavin/FlexiJoins.jl/pull/10).

Supersedes https://github.com/JuliaMath/IntervalSets.jl/pull/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

aplavin avatar Oct 16 '24 22:10 aplavin

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.84%. Comparing base (13c76e1) to head (ef2f742). Report is 17 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 16 '24 22:10 codecov[bot]

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

aplavin avatar Oct 16 '24 22:10 aplavin

I will take a look at the issue with Invalidations.yml later.

hyrodium avatar Jan 01 '25 13:01 hyrodium