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

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

[Octave-bug-tracker] [bug #61129] Performance of factor(). Proposed patc


From: anonymous
Subject: [Octave-bug-tracker] [bug #61129] Performance of factor(). Proposed patch attached.
Date: Sat, 18 Sep 2021 08:41:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0

Follow-up Comment #12, bug #61129 (project octave):

Hey! No! Stop! Patch 5 turns out to be 1.5% slower than Patch 4, against all
expectations. The problem turned out to be the single line "largeprimes =
primes(sqrt(q))((length(smallprimes)+1):end);" which was trying to not redo
the smallprimes division but it turns out the indexing is still slower than
not filtering it at all. That had been the one change from Patch 4 to Patch 5
that I didn't test beforehand, and it caused a 1.5% slowdown (several seconds
over the whole test data set, verified multiple times from both directions).
The slowdown was particularly evident for large prime numbers or products of
large prime numbers.

I've now removed that specific indexing. Simply letting it go to the division
step is faster in this case. This is 0.6% faster than Patch 4, because of
using the "foo = foo(ii)" instead of "foo(~ii) = []" which is now the only
difference from Patch 4.

Patch 6 attached. Use Patch 6 not Patch 5.

(file #51938)
    _______________________________________________________

Additional Item Attachment:

File name: patch6.patch                   Size:5 KB
    <https://file.savannah.gnu.org/file/patch6.patch?file_id=51938>



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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