octave-maintainers
[Top][All Lists]
Advanced

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

circular markersizes via rotation matrix


From: Rik
Subject: circular markersizes via rotation matrix
Date: Fri, 19 Aug 2016 14:22:45 -0700

8/19/16

Dan,

I benchmarked the current code for creating circular markers ("o") using
either the current method relying on trigonometry and sin()/cos() function
calls or via the rotation matrix that you coded which only uses
multiplications and additions.  The short story is that I didn't find any
significant difference so I left the code as is.

The initial benchmark code was:

-- Benchmark # 1 --
N = 128;

bm = zeros (N, 1);
clf;

for i = 1:N
  tic;
  plot (1:10, "o", "markersize", N);
  bm(i) = toc;
endfor

mean (bm)
-- End Benchmark # 1 --

Results were:
################################################################################
## Old way
ans =  0.014415
octave:6> median (bm)
ans =  0.014380

ans =  0.014464
octave:9> median (bm)
ans =  0.014387

ans =  0.014436
octave:14> median (bm)
ans =  0.014385

################################################################################
## New way
ans =  0.014476
octave:11> median (bm)
ans =  0.014457

ans =  0.014475
octave:15> median (bm)
ans =  0.014402

ans =  0.014554
octave:19> median (bm)
ans =  0.014341

As you can see, the statistics seem good.  There are no big outliers that
are shifting the mean away from the median, and the means differ from each
other in the 100 us range which is probably just noise in the system.

I thought maybe it might be an issue only at large markersizes where there
would be more trig function calls so I tested with a different benchmark

-- Benchmark # 2 --
N = 1e2;

clf;
bm = zeros (N, 1);
for i = 1:N
  tic;
  plot (1:10, "o", "markersize", 256);
  bm(i) = toc;
endfor

mean (bm)
-- End Benchmark # 2 --

But this didn't show any difference either.

################################################################################
## Old Way, markersize = 256
ans =  0.014353
octave:24> median (bm)
ans =  0.014217

ans =  0.014384
octave:27> median (bm)
ans =  0.014278

################################################################################
## New Way, markersize = 256
ans =  0.014487
octave:4> median (bm)
ans =  0.014412

ans =  0.014485
octave:7> median (bm)
ans =  0.014415

--Rik




reply via email to

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