diff --git a/test/tst_io.jl b/test/tst_io.jl index 79ae3d17..3afd3113 100644 --- a/test/tst_io.jl +++ b/test/tst_io.jl @@ -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