octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #58105] isfield needs time proportional to num


From: Francesco Potortì
Subject: [Octave-bug-tracker] [bug #58105] isfield needs time proportional to number of fields
Date: Sun, 9 May 2021 07:09:40 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

Follow-up Comment #5, bug #58105 (project octave):

The point is that isfield as implemented in the "workaround" is vastly
superior in terms of performance to the builtin, so the general preference to
builtin functions to user defined ones in this case should be put aside.

My code uses a struct with 15000 fields, using it as a hash table (a new field
is inserted and populated unless it already exists).  In practice, after
inserting about 400 fields the time becomes unbearably slow, and increases
linearly with number of fields.

The code using the workaround uses 28.5s, the one using the try-catch uses
26.6s, the code with the builtin uses 660s

I think that with these differences any doubt about using the workaround
should go away.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58105>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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