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

cache Type{wrapper} for faster lookups #44704

Merged
merged 1 commit into from
Apr 13, 2022
Merged

cache Type{wrapper} for faster lookups #44704

merged 1 commit into from
Apr 13, 2022

Conversation

JeffBezanson
Copy link
Sponsor Member

Benchmark from #44402:

julia> @btime Core.Compiler.widenconst(c1)
  98.999 ns (0 allocations: 0 bytes)
Type{Base.RefValue}

julia> @btime Core.Compiler.widenconst(c2)
  25.269 ns (0 allocations: 0 bytes)

alternative to #44447

mostly fixes #44402

@JeffBezanson JeffBezanson added domain:types and dispatch Types, subtyping and method dispatch compiler:latency Compiler latency labels Mar 23, 2022
@aviatesk
Copy link
Sponsor Member

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

@nanosoldier
Copy link
Collaborator

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

src/julia.h Outdated Show resolved Hide resolved
@JeffBezanson JeffBezanson force-pushed the jb/consttype branch 4 times, most recently from baa70a4 to fe34430 Compare April 6, 2022 19:25
src/jltypes.c Show resolved Hide resolved
src/jltypes.c Show resolved Hide resolved
src/jltypes.c Show resolved Hide resolved
Comment on lines +571 to 573
jl_serialize_value(s, tn->Typeofwrapper);
jl_serialize_value_(s, (jl_value_t*)tn->cache, 0);
jl_serialize_value_(s, (jl_value_t*)tn->linearcache, 0);
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Suggested change
jl_serialize_value(s, tn->Typeofwrapper);
jl_serialize_value_(s, (jl_value_t*)tn->cache, 0);
jl_serialize_value_(s, (jl_value_t*)tn->linearcache, 0);
jl_serialize_value(s, jl_atomic_load_acquire(&tn->Typeofwrapper));
jl_serialize_value_(s, (jl_value_t*)jl_atomic_load_acquire(&tn->cache), 0);
jl_serialize_value_(s, (jl_value_t*)jl_atomic_load_acquire(&tn->linearcache), 0);

(I don't yet have this file enabled for this static-analysis check, since there are other similar updates missing too)

mostly fixes #44402

Co-authored-by: Jameson Nash <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency domain:types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

widenconst of a Const(::Type) can be quite slow
4 participants