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

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

[Octave-bug-tracker] [bug #61129] Improve performance of factor() functi


From: anonymous
Subject: [Octave-bug-tracker] [bug #61129] Improve performance of factor() function
Date: Tue, 5 Oct 2021 15:40:18 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0

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

Certainly! Here are the tests:


>> clear all; x = [uint64(230584300921369) * 10000 + 3951], tic; myfactor6(x),
toc, tic, factor(x), toc
x = 2305843009213693951
ans = 2305843009213693951
Elapsed time is 6.91405 seconds.
ans = 2305843009213693951
Elapsed time is 27.5514 seconds.


Unpatched factor:

>> profile clear; profile on; factor(x); profile off; T = profile("info");
profshow(T)
   #  Function Attr     Time (s)   Time (%)        Calls
--------------------------------------------------------
  14    primes            24.460      88.72            1
  24      find             0.765       2.78            2
  32       rem             0.647       2.35            1
  25      sort             0.641       2.32            2
  13    uint64             0.320       1.16            2
  22  binary *             0.260       0.94        16410
  33 binary ==             0.199       0.72            1
  21      true             0.089       0.32            2
  20  binary -             0.061       0.22         8242
  17  binary +             0.059       0.22         8171
   1    factor             0.059       0.21            1
  23     false             0.008       0.03         8206
  27      cast             0.000       0.00            1
  37   profile             0.000       0.00            1
  12     feval             0.000       0.00            2
  26       isa             0.000       0.00            1
   5  prefix !             0.000       0.00            9
  29    strcmp             0.000       0.00            2
   3  binary <             0.000       0.00            8
   9     class             0.000       0.00            2


Patched factor with patch 6:

>> profile clear; profile on; myfactor6(x); profile off; T = profile("info");
profshow(T)
   #                Function Attr     Time (s)   Time (%)        Calls
----------------------------------------------------------------------
  14                  primes             3.803      54.98            2
  33                     mod             0.986      14.25            2
  25                    find             0.777      11.23            3
  35                    sort             0.637       9.21            1
  22                binary *             0.260       3.75        16447
  34               binary ==             0.199       2.87            2
  20                    true             0.089       1.29            3
  17                binary -             0.061       0.88         8244
  23                binary +             0.060       0.87         8209
  32 myfactor6>reducefactors             0.024       0.35            2
   1               myfactor6             0.016       0.24            1
  24                   false             0.006       0.08         8224
  38                 profile             0.000       0.00            1
  27                    cast             0.000       0.00            1
  26                     isa             0.000       0.00            2
  12                   feval             0.000       0.00            3
   5                prefix !             0.000       0.00           12
  29                  strcmp             0.000       0.00            2
   4                isscalar             0.000       0.00            3
  21                    sqrt             0.000       0.00            3



    _______________________________________________________

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]