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

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

[Octave-bug-tracker] [bug #61912] Slow performance of complex()


From: Rik
Subject: [Octave-bug-tracker] [bug #61912] Slow performance of complex()
Date: Wed, 26 Jan 2022 11:13:53 -0500 (EST)

Follow-up Comment #10, bug #61912 (project octave):

Responses to comments #7 and #8

@jwe: I agree, no need to use reinterpret_cast.  I was looking for any
technique that might show an improvement.  I guess I'll prepare a changeset
that adds in a comment about why the "new" operator is being used and make the
other small changes to not initialize the array and to use xelem.

@hg200: I noticed the same thing, specifically that function calling seems to
be quite slow.  As a test, I replaced the entire Fcomplex function in data.cc
with


return octave_value (1.0);


I then used this test code


N = 1e5;

if (! exist ("val"))
  val = rand (1e2, 1);
endif

tic;
for i = 1 : N
#  z = complex (val, val); 
  z = val + 1i*val; 
endfor
bm = toc


Timings were

complex(): 0.32
multiplication: 0.23

This is remarkable given that in the multiplication case actual work was being
done and it still beat the no-op version of complex().  That observation
probably deserves its own bug report. 

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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