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

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

[Octave-bug-tracker] [bug #48736] Multiplication is thrice as fast as di


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #48736] Multiplication is thrice as fast as division
Date: Tue, 9 Aug 2016 19:04:49 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?48736>

                 Summary: Multiplication is thrice as fast as division
                 Project: GNU Octave
            Submitted by: deego
            Submitted on: Tue 09 Aug 2016 07:04:46 PM GMT
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: Dave Goel
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:


Dear Octave,

Jordi suggested I report this. I have tested these statistics multiple times,
on several versions (3.8.2 on debian stable,  HG checkout version, etc).

The paste below, from the HG version, is representative of the general
observation: *= is much faster than /=.  And, ./= is the slowest. For
developers, this might point to optimization tricks.



The practical upshot for users is to favor *= over /=, .*=, and ./= when RHS
is a scalar.
That is, instead of using a./=33, use a*=(1/33).

octave:8> a=randn(5000,6000);
octave:9> tic; a*=2; toc ### THRICE AS FAST AS ./= BELOW.
Elapsed time is 0.133503 seconds.
octave:10> tic; a/=2; toc
Elapsed time is 0.309753 seconds.
octave:11> tic; a.*=2; toc
Elapsed time is 0.32136 seconds.
octave:12> tic; a./=2; toc
Elapsed time is 0.438965 seconds.


Dave





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48736>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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