Skip to content

Commit

Permalink
fix 1.11.0 test regression (#376)
Browse files Browse the repository at this point in the history
* fix `1.11.0` test regression

* relax test tolerance

* relax tolerance
  • Loading branch information
t-bltg committed Mar 26, 2024
1 parent e6169ba commit ae99e73
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions test/tst_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,34 @@ end
end
end

@testset "stringify plot - performance regression" begin
p = heatmap(collect(1:30) * collect(1:30)')
@test string(p; color = true) isa String # 1st pass - ttfp

measure = Sys.islinux() && VERSION > v"1.10.0" && length(VERSION.prerelease) < 2
sombrero(x, y) = 30sinc((x^2 + y^2) / π)

if measure
GC.enable(false)
stats = @timed string(p; color = true) # repeated !
@test stats.bytes / 1e3 < 400 # ~ 356kB on 1.10
@test stats.time * 1e3 < 0.5 # ~ 0.3ms on 1.10
GC.enable(true)
@testset "stringify plot - performance regression" begin
nightly = occursin("DEV", string(VERSION)) # or length(VERSION.prerelease) < 2
measure = Sys.islinux() && VERSION > v"1.10.0-" && !nightly

let p = heatmap(collect(1:30) * collect(1:30)')
@test string(p; color = true) isa String # 1st pass - ttfp

if measure
GC.enable(false)
stats = @timed string(p; color = true) # repeated !
@test stats.bytes / 1e3 < 500 # ~ 356kB on 1.10
@test stats.time * 1e3 < 0.8 # ~ 0.3ms on 1.10
GC.enable(true)
end
end

sombrero(x, y) = 30sinc((x^2 + y^2) / π)
p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false)
@test string(p; color = true) isa String # 1st pass - ttfp
let p = surfaceplot(-8:0.5:8, -8:0.5:8, sombrero; axes3d = false)
@test string(p; color = true) isa String # 1st pass - ttfp

if measure
GC.enable(false)
stats = @timed string(p; color = true) # repeated !
@test stats.bytes / 1e3 < 160 # ~ 152kB on 1.10
@test stats.time * 1e3 < 0.5 # ~ 0.26ms on 1.10
GC.enable(true)
if measure
GC.enable(false)
stats = @timed string(p; color = true) # repeated !
@test stats.bytes / 1e3 < 160 # ~ 152kB on 1.10
@test stats.time * 1e3 < 0.5 # ~ 0.26ms on 1.10
GC.enable(true)
end
end
end

Expand Down

0 comments on commit ae99e73

Please sign in to comment.