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: Mon, 24 Jan 2022 19:33:30 -0500 (EST)

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

I was specifically testing the scalar case where the scalar is a real that
needs to be made complex.

I modified to try a vector using the code below


N = 1e5;

val = rand (1e4, 1);

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


Results still favor using multiplication
complex() : 3.1 seconds
multiply  : 1.7 seconds

@Arun: I think you need to run the test multiple times in a for loop in order
to get adequate statistics.  If you are executing only one time it is possible
that an interrupt happens and the CPU goes off for a while working on
something else and then returns to the Octave thread.  If that happens only
for one of the test conditions then it is unfairly penalized.

    _______________________________________________________

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]