-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Remove unnecessary check in Memory creation #52068
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
Conversation
|
|
||
| # type and dimensionality specified | ||
| (self::Type{GenericMemory{kind,T,addrspace}})(::UndefInitializer, m::Int) where {T,addrspace,kind} = | ||
| if isdefined(self, :instance) && m === 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs some supporting performance analysis, since it hardly even appears in the IR after optimization
julia> code_typed(Memory{Int}, (Core.UndefInitializer, Int))
1-element Vector{Any}:
CodeInfo(
1 ─ nothing::Nothing
│ @ boot.jl:498 within `GenericMemory`
│ %2 = (m === 0)::Bool
└── goto #3 if not %2
@ boot.jl:500 within `GenericMemory`
2 ─ %4 = Core.getproperty(self, :instance)::Memory{Int64}
└── return %4
@ boot.jl:502 within `GenericMemory`
3 ─ %6 = $(Expr(:foreigncall, :(:jl_alloc_genericmemory), Ref{GenericMemory{kind, T, addrspace}}, svec(Any, Int64), 0, :(:ccall), Core.Argument(1), Core.Argument(3), Core.Argument(3)))::Memory{Int64}
└── return %6
) => Memory{Int64}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entire thing is in the IR.
|
@nanosoldier |
|
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
|
@nanosoldier |
|
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
|
Looks like one 6X reduction and no improvements? |
|
I see quite a few improvements? |
|
I might have missed it, since I scroll pretty fast usually. Which one? |
No description provided.