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

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

[Octave-bug-tracker] [bug #33221] subsasgn without LHS should do in-plac


From: Rik
Subject: [Octave-bug-tracker] [bug #33221] subsasgn without LHS should do in-place assignment for performance
Date: Thu, 17 Nov 2016 19:09:14 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Update of bug #33221 (project octave):

                  Status:               Need Info => Confirmed              
                 Summary: subsasgn without LHS assignment Matlab
incompatibility => subsasgn without LHS should do in-place assignment for
performance

    _______________________________________________________

Follow-up Comment #2:

The optimization *may* be possible.  The operators such as '+=' or '-=' use
in-place optimization and are significantly faster.


octave:6> x = rand (1000,1000);
octave:7> tic; x = x + 1; toc
Elapsed time is 0.0022521 seconds.
octave:8> tic; x += 1; toc
Elapsed time is 0.00102091 seconds.


It already appears that indexing in the normal case is in-place.


octave:9> x = rand (1000,1000);
octave:10> tic; x(2,2) = 1; toc
Elapsed time is 2.69413e-05 seconds.
octave:11> idx = struct ("type", "()", "subs", {{2,2}});
octave:12> tic; subsasgn (x, idx, -1); toc
Elapsed time is 0.0146961 seconds.


Thus, it is a question of whether there is a way to hook in to the operator
based function or not.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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