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

typemap: attempt split on typenames also #35384

Merged
merged 3 commits into from
Jul 14, 2020
Merged

typemap: attempt split on typenames also #35384

merged 3 commits into from
Jul 14, 2020

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Apr 6, 2020

This is a recreation of #16418, now working due to many changes in the meantime! In measurements, it appears to successfully shave significant time off require calls:

$ time ./usr/bin/julia -e 'using DataFrames'
user 0m1.192s => 0m0.887s

$ time ./usr/bin/julia -e 'using Plots'
user 0m3.240s => 0m2.056s

$ time ./usr/bin/julia -e 'using ApproxFun
user 0m21.551s => 0m11.953s

src/typemap.c Outdated Show resolved Hide resolved
src/typemap.c Outdated
jl_datatype_t *dt = (jl_datatype_t*)t1;
if ((abstract || !dt->abstract) && !jl_is_kind(t1))
return 0;
return 1;
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

In this case we return NULL above, so in what sense is that imprecise? Or maybe a better question is, when does this function differ from jl_type_extract_name() == NULL?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

I suppose NULL is imprecise in the sense that we'll never consider asking this jl_type_extract_name_imprecise question if the result was NULL?

src/typemap.c Outdated Show resolved Hide resolved
src/julia.h Outdated Show resolved Hide resolved
src/julia.h Outdated Show resolved Hide resolved
src/julia.h Show resolved Hide resolved
src/typemap.c Outdated
jl_datatype_t *dt = (jl_datatype_t*)t1;
if ((abstract || !dt->abstract) && !jl_is_kind(t1))
return 0;
return 1;
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

I suppose NULL is imprecise in the sense that we'll never consider asking this jl_type_extract_name_imprecise question if the result was NULL?

src/typemap.c Show resolved Hide resolved
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jul 8, 2020

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

@vtjnash vtjnash marked this pull request as ready for review July 8, 2020 15:50
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jul 8, 2020

$ time ./julia -e '@time using Plots; @time display(@time plot(1:10))'
  4.815404 seconds (11.86 M allocations: 742.897 MiB, 4.46% gc time)
  1.499383 seconds (2.45 M allocations: 139.535 MiB, 2.96% gc time)
  4.883966 seconds (8.14 M allocations: 457.537 MiB, 2.23% gc time)

real	0m10.145s
user	0m9.966s
sys	0m0.384s

@nanosoldier
Copy link
Collaborator

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

If the parameter is a TypeVar, it cnan have subtypes that might appear
in the map itself and require a scan to locate.
This is an odd inversion in the specificity lattice where supertype(T)
is more specific than T (and type-equal to T). Handle that here by
consistently normalizing to the more specific copy, to avoid
complications later.
… argument

Previously, the TypeMap could only split on leaf types. Now it also has
the ability to split on more abstract types.

This helps gives types their own linear list to scan to find its
constructors, instead of needing to search through all constructors.
@vtjnash vtjnash merged commit dff83f2 into master Jul 14, 2020
@vtjnash vtjnash deleted the jn/typemap-name2 branch July 14, 2020 14:58
@JeffBezanson JeffBezanson added the compiler:latency Compiler latency label Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants