Skip to content

Commit df6c09d

Browse files
authored
Short-circuit update_clims if not necessary (#4743)
1 parent 32e2b7b commit df6c09d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/colorbars.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6
1717
zmin, zmax = Inf, -Inf
1818
for series in series_list(sp)
1919
if series[:colorbar_entry]::Bool
20-
zmin, zmax = _update_clims(zmin, zmax, update_clims(series, op)...)
20+
# Avoid calling the inner `update_clims` if at all possible; dynamic dispatch hell
21+
if (series[:seriestype] _z_colored_series && series[:z] !== nothing) ||
22+
series[:line_z] !== nothing ||
23+
series[:marker_z] !== nothing ||
24+
series[:fill_z] !== nothing
25+
zmin, zmax = _update_clims(zmin, zmax, update_clims(series, op)...)
26+
else
27+
zmin, zmax = _update_clims(zmin, zmax, NaN, NaN)
28+
end
2129
else
2230
update_clims(series, op)
2331
end

0 commit comments

Comments
 (0)