[Numpy-discussion] Set values of a matrix within a specified range to zero
Tue Mar 30 16:57:39 CDT 2010
On Tue, Mar 30, 2010 at 3:40 PM, Robert Kern <firstname.lastname@example.org> wrote:
> On Tue, Mar 30, 2010 at 16:35, Ryan May <email@example.com> wrote:
>> On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt
>> <firstname.lastname@example.org> wrote:
>>> x *= ((x <= 23) | (x >= 45)) .
>> Interesting. In an ideal world, I'd love to see why exactly that is,
>> because I don't think multiplication should be faster than a boolean
> Branch prediction failures are really costly in modern CPUs.
That makes sense.
I still maintain that for 95% of code, easy to understand code is more
important than performance differences due to branch misprediction.
(And more importantly, we don't want to be teaching new users to code
like that from the beginning.)
Graduate Research Assistant
School of Meteorology
University of Oklahoma
More information about the NumPy-Discussion