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

Replace Vector with BitSet in optimization passes #46587

Merged
merged 7 commits into from
Oct 8, 2022

Conversation

LilithHafner
Copy link
Member

@LilithHafner LilithHafner commented Sep 2, 2022

I was unable to determine why this sorting operation is needed. I tracked it down to 8af40ea so perhaps Keno (waiting for CI to pass to ping) knows if there is a reason to keep this?

Closes #46507

@LilithHafner LilithHafner added the compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) label Sep 2, 2022
@vtjnash
Copy link
Member

vtjnash commented Sep 2, 2022

@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here.

@LilithHafner LilithHafner changed the title Remove unnecessary sorting operation in optimization passes Replace Vector with BitSet in optimization passes Sep 4, 2022
@LilithHafner
Copy link
Member Author

LilithHafner commented Sep 4, 2022

While the performance improvements are negligible, it seems plausible that the previous approach could result in quadratic runtime in certain cases due to

while !(curblock in allblocks) && curblock !== 0
curblock = domtree.idoms_bb[curblock]
end

I think this change is worth making. Whitespace is broken due to old master.

@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Merging #46587 (e1139e7) into master (c0d5ffb) will increase coverage by 0.05%.
The diff coverage is n/a.

❗ Current head e1139e7 differs from pull request most recent head 9eea1b8. Consider uploading reports for the commit 9eea1b8 to get more accurate results

@@            Coverage Diff             @@
##           master   #46587      +/-   ##
==========================================
+ Coverage   93.63%   93.69%   +0.05%     
==========================================
  Files         380      387       +7     
  Lines       85981    86056      +75     
==========================================
+ Hits        80508    80628     +120     
+ Misses       5473     5428      -45     
Impacted Files Coverage Δ
compiler/ssair/passes.jl 85.50% <0.00%> (-5.35%) ⬇️
uuid.jl 97.10% <0.00%> (-2.90%) ⬇️
Base.jl 95.23% <0.00%> (-2.49%) ⬇️
env.jl 92.30% <0.00%> (-1.93%) ⬇️
compiler/ssair/ir.jl 79.72% <0.00%> (-0.85%) ⬇️
compiler/ssair/irinterp.jl 85.99% <0.00%> (-0.81%) ⬇️
compiler/ssair/inlining.jl 95.22% <0.00%> (-0.59%) ⬇️
operators.jl 97.15% <0.00%> (-0.56%) ⬇️
compiler/ssair/domtree.jl 94.06% <0.00%> (-0.46%) ⬇️
expr.jl 94.40% <0.00%> (-0.35%) ⬇️
... and 430 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@LilithHafner
Copy link
Member Author

Bump (c.f. #46679 (comment)). There doesn't seem to be much practical performance impact of this PR, but it is a theoretical improvement and more importantly, it reduces Core's dependency on Sort, which is needed for #46679.

@LilithHafner
Copy link
Member Author

Rerunning benchmarks after rebase
@nanosoldier runbenchmarks("inference", vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - no performance regressions were detected. A full report can be found here.

@oscardssmith
Copy link
Member

I'm merging this today sans objections.

@LilithHafner LilithHafner merged commit 60adc24 into master Oct 8, 2022
@LilithHafner LilithHafner deleted the remove-sort-allblocks branch October 8, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants