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

stop specializing on argument types of display #28616

Merged
merged 1 commit into from
Aug 14, 2018
Merged

Conversation

KristofferC
Copy link
Sponsor Member

@KristofferC KristofferC commented Aug 12, 2018

There is no real advantage in specializing on the argument types for display since it goes through a quite complicated machinery of trying to find applicable displays anyway. This function is getting compiled for every type we show in the REPL for example.

Before:

julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:

julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)
@KristofferC KristofferC merged commit eabb601 into master Aug 14, 2018
@KristofferC KristofferC deleted the kc/nospec_display branch August 14, 2018 23:44
KristofferC added a commit that referenced this pull request Aug 19, 2018
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
KristofferC added a commit that referenced this pull request Aug 19, 2018
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
@KristofferC KristofferC mentioned this pull request Aug 19, 2018
KristofferC added a commit that referenced this pull request Aug 19, 2018
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
KristofferC added a commit that referenced this pull request Sep 8, 2018
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
KristofferC added a commit that referenced this pull request Sep 8, 2018
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
KristofferC added a commit that referenced this pull request Feb 11, 2019
there is no real advantage in specializing on the argument types
for display since it goes through a quite complicated machinery
of trying to find applicable displays.

Before:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end
  0.034542 seconds (37.08 k allocations: 1.916 MiB)
  0.042272 seconds (92.57 k allocations: 4.810 MiB)
  0.039003 seconds (90.20 k allocations: 4.758 MiB)
  0.030826 seconds (61.08 k allocations: 3.066 MiB)

After:
julia> let
        @time precompile(Tuple{typeof(Base.Multimedia.display), Int32})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Vector{Int}})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Float64})
        @time precompile(Tuple{typeof(Base.Multimedia.display), Symbol})
       end

  0.000041 seconds (12 allocations: 640 bytes)
  0.000029 seconds (10 allocations: 544 bytes)
  0.000024 seconds (9 allocations: 496 bytes)
  0.000021 seconds (9 allocations: 496 bytes)

(cherry picked from commit eabb601)
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.

None yet

2 participants