[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52706] Rewrite xpow.cc using templates
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #52706] Rewrite xpow.cc using templates |
Date: |
Fri, 22 Dec 2017 18:09:10 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 |
Follow-up Comment #8, bug #52706 (project octave):
I assume you mean things like this that appear in Array.h?
octave_idx_type i;
for (i = 0; i < len - 3; i += 4)
{
octave_quit ();
p[i] = fcn (m[i]);
p[i+1] = fcn (m[i+1]);
p[i+2] = fcn (m[i+2]);
p[i+3] = fcn (m[i+3]);
}
octave_quit ();
for (; i < len; i++)
p[i] = fcn (m[i]);
Instead of duplicating code like this many times, maybe we could do this loop
unrolling job with a template as well?
Also, I would not worry too much about calling octave_quit every time through
a loop if the loop does any substantial amount of work since it is a function
that should be easily inlined to be a check on a global variable. Nothing
more should happen unless an signal has been caught. Maybe that affects
performance enough to notice, but if it does, then I suspect we should be
unrolling the loop more than 4 times.
We could also probably gain something by properly using function parameters in
templates instead of function pointers. This may not apply to xpow.cc, but I
think it does in other places like bsxfun.cc.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52706>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Marco Caliari, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Rik, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, John W. Eaton, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Rik, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Marco Caliari, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Rik, 2017/12/20
- [Octave-bug-tracker] [bug #52706] mpower compatibility behavior, Marco Caliari, 2017/12/21
- [Octave-bug-tracker] [bug #52706] Rewrite xpow.cc using templates, Rik, 2017/12/22
- [Octave-bug-tracker] [bug #52706] Rewrite xpow.cc using templates,
John W. Eaton <=