[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65089] assert may become excessively slow in

From: anonymous
Subject: [Octave-bug-tracker] [bug #65089] assert may become excessively slow in case of large matrices
Date: Thu, 28 Dec 2023 11:30:39 -0500 (EST)


                 Summary: assert may become excessively slow in case of large
                   Group: GNU Octave
               Submitter: None
               Submitted: Thu 28 Dec 2023 04:30:36 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name: octave-user
        Originator Email: octave-user@a1.net
             Open/Closed: Open
                 Release: 8.4.0
         Discussion Lock: Any
        Operating System: GNU/Linux
           Fixed Release: None
         Planned Release: None


Follow-up Comments:

Date: Thu 28 Dec 2023 04:30:36 PM UTC By: Anonymous
Dear GNU-Octave developers,

If you execute the following code in Octave, it will take forever.

tol = eps;
N = 1000;
a = rand(N, N);
b = rand(N, N);
assert(a, b, tol);

Obviously, one could rewrite the above code as follows:

tol = eps;
N = 1000;
a = rand(N, N);
b = rand(N, N);

However, if you have a large testsuite with many calls to assert, your whole
testsuite might be broken, just because a single assert fails. Rewriting the
whole testsuite might be tedious. Now I'm considering the option to replace
all my calls to assert by a custom version of assert which does not have such
a performance issue.

Nevertheless, I think that it would be a good idea to limit somehow the length
of the error message generated by assert, because nobody would read an error
message with one million lines. For example, maximum 1000 differences larger
than the tolerance could be reported. As an alternative, assert could just
report the maximum error or the total number of values with a difference above
the tolerance. A remark could be added, that the complete error message would
be too long to display it.

Please let me know if such an option would be acceptable for you!
In that case I could create and submit a patch for assert.


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]