From 7752c344d49fb5d56f11cfb74bb6ad90b517bf01 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 10 Oct 2023 21:32:23 +0200 Subject: [PATCH 1/4] add timings + used memory to tests --- ReferenceTests/src/database.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ReferenceTests/src/database.jl b/ReferenceTests/src/database.jl index 7db2c8eafb7..ff5e5dfa865 100644 --- a/ReferenceTests/src/database.jl +++ b/ReferenceTests/src/database.jl @@ -29,6 +29,7 @@ macro reference_test(name, code) funcs = used_functions(code) skip = (title in SKIP_TITLES) || any(x-> x in funcs, SKIP_FUNCTIONS) return quote + t1 = time() @testset $(title) begin if $skip @test_broken false @@ -46,6 +47,11 @@ macro reference_test(name, code) push!($REGISTERED_TESTS, $title) end end + GC.gc(true) + elapsed = round(time() - t1; digits=3) + mem = (Sys.total_memory() - Sys.free_memory()) / 10^9 + # TODO, write to file and create an overview in the end, similar to the benchmark results! + println("Used RAM: $(mem), time: $(elapsed)s") end end From 8dcea162ba3f4cb10ae08125699e43445f34ce41 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Thu, 12 Oct 2023 16:31:55 +0200 Subject: [PATCH 2/4] print available ram and test texture_atlas size --- ReferenceTests/src/database.jl | 5 +++-- WGLMakie/test/runtests.jl | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ReferenceTests/src/database.jl b/ReferenceTests/src/database.jl index ff5e5dfa865..f8d51e3eae6 100644 --- a/ReferenceTests/src/database.jl +++ b/ReferenceTests/src/database.jl @@ -49,9 +49,10 @@ macro reference_test(name, code) end GC.gc(true) elapsed = round(time() - t1; digits=3) - mem = (Sys.total_memory() - Sys.free_memory()) / 10^9 + total = Sys.total_memory() + mem = round((Sys.total_memory() - Sys.free_memory()) / 10^9; digits=3) # TODO, write to file and create an overview in the end, similar to the benchmark results! - println("Used RAM: $(mem), time: $(elapsed)s") + println("Used $(mem)gb of $(round(total; digits=3))gb RAM, time: $(elapsed)s") end end diff --git a/WGLMakie/test/runtests.jl b/WGLMakie/test/runtests.jl index 3d13c3cb842..ab3d5a1d7c0 100644 --- a/WGLMakie/test/runtests.jl +++ b/WGLMakie/test/runtests.jl @@ -62,4 +62,5 @@ Makie.inline!(Makie.automatic) recorded_files, recording_dir = @include_reference_tests "refimages.jl" missing_images, scores = ReferenceTests.record_comparison(recording_dir) ReferenceTests.test_comparison(scores; threshold = 0.032) + @test Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6 < 8.5 end From b70b1b7ef849605afbea5b51f9b76395533ea8d2 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Thu, 12 Oct 2023 17:23:23 +0200 Subject: [PATCH 3/4] make sure texture atlas doesn't grow in size --- WGLMakie/test/runtests.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WGLMakie/test/runtests.jl b/WGLMakie/test/runtests.jl index ab3d5a1d7c0..32360727453 100644 --- a/WGLMakie/test/runtests.jl +++ b/WGLMakie/test/runtests.jl @@ -62,5 +62,10 @@ Makie.inline!(Makie.automatic) recorded_files, recording_dir = @include_reference_tests "refimages.jl" missing_images, scores = ReferenceTests.record_comparison(recording_dir) ReferenceTests.test_comparison(scores; threshold = 0.032) - @test Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6 < 8.5 + +end + +@testset "memory leaks" begin + GC.gc(true) + @test Base.summarysize(WGLMakie.TEXTURE_ATLAS) / 10^6 < 9 end From 0bc5c0eb3723c7bc6a9831bb525272ca9639cbde Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 12 Oct 2023 20:06:05 +0200 Subject: [PATCH 4/4] Update database.jl --- ReferenceTests/src/database.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ReferenceTests/src/database.jl b/ReferenceTests/src/database.jl index f8d51e3eae6..6a8480d2f88 100644 --- a/ReferenceTests/src/database.jl +++ b/ReferenceTests/src/database.jl @@ -47,12 +47,11 @@ macro reference_test(name, code) push!($REGISTERED_TESTS, $title) end end - GC.gc(true) elapsed = round(time() - t1; digits=3) total = Sys.total_memory() - mem = round((Sys.total_memory() - Sys.free_memory()) / 10^9; digits=3) + mem = round((total - Sys.free_memory()) / 10^9; digits=3) # TODO, write to file and create an overview in the end, similar to the benchmark results! - println("Used $(mem)gb of $(round(total; digits=3))gb RAM, time: $(elapsed)s") + println("Used $(mem)gb of $(round(total / 10^9; digits=3))gb RAM, time: $(elapsed)s") end end