From db685b6ee0c133362f2b53e42d0346f99d6bbe5a Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Sat, 24 Aug 2019 01:17:47 -0400 Subject: [PATCH] more noinline --- src/pipeline.jl | 18 +++++++++--------- src/plot.jl | 13 +++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/pipeline.jl b/src/pipeline.jl index e3615536..dfbc219c 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -3,11 +3,11 @@ # ------------------------------------------------------------------ # preprocessing -function command_idx(kw_list::AVec{KW}, kw::KW) +@noinline function command_idx(kw_list::AVec{KW}, kw::KW) Int(kw[:series_plotindex]) - Int(kw_list[1][:series_plotindex]) + 1 end -function _expand_seriestype_array(plotattributes::KW, args) +@noinline function _expand_seriestype_array(plotattributes::KW, args) sts = get(plotattributes, :seriestype, :path) if typeof(sts) <: AbstractArray delete!(plotattributes, :seriestype) @@ -132,7 +132,7 @@ function _preprocess_userrecipe(kw::KW) return end -function _add_errorbar_kw(kw_list::Vector{KW}, kw::KW) +@noinline function _add_errorbar_kw(kw_list::Vector{KW}, kw::KW) # handle error bars by creating new recipedata data... these will have # the same recipedata index as the recipedata they are copied from for esym in (:xerror, :yerror) @@ -147,7 +147,7 @@ function _add_errorbar_kw(kw_list::Vector{KW}, kw::KW) end end -function _add_smooth_kw(kw_list::Vector{KW}, kw::KW) +@noinline function _add_smooth_kw(kw_list::Vector{KW}, kw::KW) # handle smoothing by adding a new series if get(kw, :smooth, false) x, y = kw[:x], kw[:y] @@ -257,11 +257,11 @@ function _subplot_setup(plt::Plot{T}, plotattributes::KW, kw_list::Vector{KW}) w # Subplot/Axis attributes set by a user/series recipe apply only to the # Subplot object which they belong to. # TODO: allow matrices to still apply to all subplots - sp_attrs = Dict{Subplot{T},Any}() + sp_attrs = Dict{Any,Any}() for kw in kw_list # get the Subplot object to which the series belongs. sps = get(kw, :subplot, :auto) - sp::Subplot{T} = get_subplot(plt, _cycle(sps == :auto ? plt.subplots : plt.subplots[sps], command_idx(kw_list,kw))) + sp = get_subplot(plt, _cycle(sps == :auto ? plt.subplots : plt.subplots[sps], command_idx(kw_list,kw))) kw[:subplot] = sp # extract subplot/axis attributes from kw and add to sp_attr attr = KW() @@ -326,7 +326,7 @@ end # ------------------------------------------------------------------ # series types -function _override_seriestype_check(plotattributes::KW, st::Symbol) +@noinline function _override_seriestype_check(plotattributes::KW, st::Symbol) # do we want to override the series type? if !is3d(st) && !(st in (:contour,:contour3d)) z = plotattributes[:z] @@ -338,7 +338,7 @@ function _override_seriestype_check(plotattributes::KW, st::Symbol) st end -function _prepare_annotations(sp::Subplot, plotattributes::KW) +@noinline function _prepare_annotations(sp::Subplot, plotattributes::KW) # strip out series annotations (those which are based on series x/y coords) # and add them to the subplot attr sp_anns = annotations(sp[:annotations]) @@ -371,7 +371,7 @@ function _expand_subplot_extrema(sp::Subplot, plotattributes::KW, st::Symbol) end end -function _add_the_series(plt, sp, plotattributes) +@noinline function _add_the_series(plt, sp, plotattributes) warnOnUnsupported_args(plt.backend, plotattributes) warnOnUnsupported(plt.backend, plotattributes) series = Series(plotattributes) diff --git a/src/plot.jl b/src/plot.jl index 84694902..942eecb2 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -4,13 +4,13 @@ mutable struct CurrentPlot end const CURRENT_PLOT = CurrentPlot(nothing) -isplotnull() = CURRENT_PLOT.nullableplot === nothing +@noinline isplotnull() = CURRENT_PLOT.nullableplot === nothing """ current() Returns the Plot object for the current plot """ -function current() +@noinline function current() if isplotnull() error("No current plot/subplot") end @@ -25,9 +25,9 @@ Base.string(plt::Plot) = "Plot{$(plt.backend) n=$(plt.n)}" Base.print(io::IO, plt::Plot) = print(io, string(plt)) Base.show(io::IO, plt::Plot) = print(io, string(plt)) -getplot(plt::Plot) = plt -getattr(plt::Plot, idx::Int = 1) = plt.attr -convertSeriesIndex(plt::Plot, n::Int) = n +@noinline getplot(plt::Plot) = plt +@noinline getattr(plt::Plot, idx::Int = 1) = plt.attr +@noinline convertSeriesIndex(plt::Plot, n::Int) = n # --------------------------------------------------------- @@ -207,7 +207,7 @@ function _plot!(plt::Plot{T}, plotattributes::KW, args::Vector{Any}) where {T} # 6 seconds _subplot_setup(plt, plotattributes, kw_list) - + #= # !!! note: At this point, kw_list is fully decomposed into individual series... one KW per series. !!! # !!! The next step is to recursively apply series recipes until the backend supports that series type !!! @@ -246,6 +246,7 @@ function _plot!(plt::Plot{T}, plotattributes::KW, args::Vector{Any}) where {T} # end _do_plot_show(plt, plt[:show]) plt + =# end