Skip to content

simplify inline cost computation, update docs #42997

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

Merged
merged 2 commits into from
Nov 10, 2021
Merged

simplify inline cost computation, update docs #42997

merged 2 commits into from
Nov 10, 2021

Conversation

aviatesk
Copy link
Member

@aviatesk aviatesk commented Nov 8, 2021

No description provided.

sig == Tuple{sig.parameters[1],Any,Any,Any,Vararg{Any}})
inlineable = true
sig === Tuple{sig.parameters[1],Any,Any,Any,Vararg{Any}})
return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we using

diff --git a/base/operators.jl b/base/operators.jl
index 82b393e0a9..dcc0c3704a 100644
--- a/base/operators.jl
+++ b/base/operators.jl
@@ -636,7 +636,7 @@ for op in (:+, :*, :&, :|, :xor, :min, :max, :kron)
         # note: these definitions must not cause a dispatch loop when +(a,b) is
         # not defined, and must only try to call 2-argument definitions, so
         # that defining +(a,b) is sufficient for full functionality.
-        ($op)(a, b, c, xs...) = afoldl($op, ($op)(($op)(a,b),c), xs...)
+        @inline ($op)(a, b, c, xs...) = afoldl($op, ($op)(($op)(a,b),c), xs...)
         # a further concern is that it's easy for a type like (Int,Int...)
         # to match many definitions, so we need to keep the number of
         # definitions down to avoid losing type information.

since 7bdf9c6 / f8d2294 (#11274 / #13350) / 86ffe49 (#5011)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference seems to be that the definition-site annotation is only respected when the call signature is concrete ?

if src.inlineable && isdispatchtuple(specTypes)
# obey @inline declaration if a dispatch barrier would not help

Well, I don't think it makes much difference in reality (we can't get best performance when there is type instability anyway), and so I'm inclined to simply switch to the annotation.

@aviatesk aviatesk changed the title update inlining docs, minor clean-ups simplify inline cost computation, update docs Nov 9, 2021
@aviatesk
Copy link
Member Author

aviatesk commented Nov 9, 2021

@nanosoldier runbenchmarks("union" || "array", vs="@e3b9290e0c8569a321269c2af3fa5dea39bdf450")

@aviatesk
Copy link
Member Author

aviatesk commented Nov 9, 2021

@nanosoldier runbenchmarks("union" || "array" || "sort" || "foldl", vs="@e3b9290e0c8569a321269c2af3fa5dea39bdf450")

@nanosoldier
Copy link
Collaborator

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

@nanosoldier
Copy link
Collaborator

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

@aviatesk
Copy link
Member Author

@nanosoldier runbenchmarks("union" || "array" || "sort" || "foldl", vs="master")

@aviatesk
Copy link
Member Author

@nanosoldier runbenchmarks("union" || "array" || "sort" || "foldl", vs=":master")

@nanosoldier
Copy link
Collaborator

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

@vtjnash vtjnash merged commit dba8f03 into master Nov 10, 2021
@vtjnash vtjnash deleted the avi/inlinedoc branch November 10, 2021 20:55
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
Removes a special inline treatment that seems probably antiquated.
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Removes a special inline treatment that seems probably antiquated.
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.

4 participants