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

Micro-optimization in WeakKeyDict constructor #49690

Merged
merged 1 commit into from
May 9, 2023
Merged

Conversation

LilithHafner
Copy link
Member

The Dict{Any, Any}() is getting allocated and discarded. This should save about 70ns.

julia> @btime convert(Dict{WeakRef,Int}, Dict{Any,Int}())
  133.890 ns (8 allocations: 1.03 KiB)
Dict{WeakRef, Int64}()

julia> @btime convert(Dict{WeakRef,Int}, Dict{WeakRef,Int}())
  61.184 ns (4 allocations: 528 bytes)
Dict{WeakRef, Int64}()

@LilithHafner LilithHafner added the performance Must go faster label May 8, 2023
@aviatesk aviatesk merged commit 493a16a into master May 9, 2023
@aviatesk aviatesk deleted the LilithHafner-patch-2 branch May 9, 2023 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants