# HG changeset patch # User David Miguel Susano Pinto # Date 1712147332 -3600 # Node ID 27e915d3a79cfe23ce9b023a42fb132018d39d95 # Parent af2b017a5a7abb5ce140b48c8b648b46c1cd6624 test: speed up BIST for the central part of convn with 'full' shape. The test for bug #39314 requires a particularly long array. That array has 176,800 elements (size of [13 17 8 10 10]). The test checks if the central part of a "full" convolution is the same as the "valid" convolution (it is not, this is bug #39314). The assert command then shows all the elements that are different (effectively all) which makes it extremely slow for such a large array. This commit changes the test so it does the comparison first, and only passes a true/false to "assert". The end performance improvement will be machine and options dependent but in my machine it reduces the test time from 6 to 0.7 seconds. On Discourse (https://octave.discourse.group/t/conv2-test-time-rather-long/5446/18) some people were experiencing 15 minutes for this test alone. * conv2.cc: Check equality of observed and expected arrays and pass true/false result to assert. diff -r af2b017a5a7a -r 27e915d3a79c libinterp/corefcn/conv2.cc --- a/libinterp/corefcn/conv2.cc Thu Apr 18 20:59:19 2024 +0200 +++ b/libinterp/corefcn/conv2.cc Wed Apr 03 13:28:52 2024 +0100 @@ -435,7 +435,8 @@ %! c = convn (a, b, "full"); %!assert (convn (a, b, "same"), c(2:11,2:11,2:11)) %!test <39314> -%! assert (convn (a, b, "valid"), c(3:10,3:10,3:10)); +%! assert (all ((convn (a, b, "valid") == c(3:10,3:10,3:10))(:)), +%! "central part of convn 'full' differs from convn 'valid'"); %! %!test %! old_state = rand ("state"); @@ -447,7 +448,8 @@ %! c = convn (a, b, "full"); %!assert (convn (a, b, "same"), c(2:11,2:11,:)) %!test <39314> -%! assert (convn (a, b, "valid"), c(3:10,3:10,:)); +%! assert (all ((convn (a, b, "valid") == c(3:10,3:10,:))(:)), +%! "central part of convn 'full' differs from convn 'valid'"); %! %!test %! old_state = rand ("state"); @@ -470,7 +472,8 @@ %! c = convn (a, b, "full"); %!assert (convn (a, b, "same"), c(3:12,2:16,2:8,2:9,:)) %!test <39314> -%! assert (convn (a, b, "valid"), c(4:10,3:15,2:7,3:8,:)); +%! assert (all ((convn (a, b, "valid") == c(4:10,3:15,2:7,3:8,:))(:)), +%! "central part of convn 'full' differs from convn 'valid'"); %!test %! a = reshape (floor (magic (16) /10), [4 8 4 2]);