[Webkit-unassigned] [Bug 36849] Add zero() method to Vector class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 31 14:59:31 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=36849





--- Comment #11 from Chris Rogers <crogers at google.com>  2010-03-31 14:59:31 PST ---
(In reply to comment #9)
> Do we really need this method in the Vector class? It may be a bit more
> concise, but it seems like overkill. I don't think it will improve performance
> in any significant way, and I don't thing 'zero()' is any more clear than
> 'fill(0)'. It seems like it just unnecessarily adds to the size of the API of
> this function.

For many applications the performance benefit may be fairly small, but for
audio it makes sense.  When I worked on the CoreAudio team we were pressured
very hard to make these types of optimizations, unroll loops, write SIMD code
(altivec, SSE), etc.

The "footprint" of having a zero() method doesn't seem that heavy to me.  But
if people really don't like to have the method in the Vector class, then I
could certainly write helper functions which use memset() - something like:

void zero(Vector<float>);
void zero(Vector<double>);

These could be defined in Vector.h, somewhere else in wtf, or directly in my
audio directory.

The reason I made this patch is because people didn't like the idea of me
sub-classing Vector in order to implement a zero() method (in addition to some
other things) in this bug:

https://bugs.webkit.org/show_bug.cgi?id=34452

Adam Barth suggested I could implement this in Vector (using traits).  The
other approaches (subclassing or helper functions) are also fine with me.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list