Author: Ronan Lamy <ronan.l...@gmail.com> Branch: use_min_scalar Changeset: r77782:22a1e48d9fc0 Date: 2015-06-02 17:52 +0100 http://bitbucket.org/pypy/pypy/changeset/22a1e48d9fc0/
Log: Switch to the scalar fast path earlier in W_Ufunc2.call() diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py --- a/pypy/module/micronumpy/ufuncs.py +++ b/pypy/module/micronumpy/ufuncs.py @@ -605,18 +605,18 @@ w_rdtype.get_name(), w_ldtype.get_name(), self.name) - calc_dtype, dt_out, func = self.find_specialization( - space, w_ldtype, w_rdtype, out, casting, w_lhs, w_rhs) - if (isinstance(w_lhs, W_GenericBox) and isinstance(w_rhs, W_GenericBox) and out is None): - return self.call_scalar(space, w_lhs, w_rhs, calc_dtype) + return self.call_scalar(space, w_lhs, w_rhs, casting) if isinstance(w_lhs, W_GenericBox): w_lhs = W_NDimArray.from_scalar(space, w_lhs) assert isinstance(w_lhs, W_NDimArray) if isinstance(w_rhs, W_GenericBox): w_rhs = W_NDimArray.from_scalar(space, w_rhs) assert isinstance(w_rhs, W_NDimArray) + calc_dtype, dt_out, func = self.find_specialization( + space, w_ldtype, w_rdtype, out, casting, w_lhs, w_rhs) + new_shape = shape_agreement(space, w_lhs.get_shape(), w_rhs) new_shape = shape_agreement(space, new_shape, out, broadcast_down=False) w_highpriority, out_subtype = array_priority(space, w_lhs, w_rhs) @@ -633,7 +633,10 @@ w_res = space.call_method(w_highpriority, '__array_wrap__', w_res) return w_res - def call_scalar(self, space, w_lhs, w_rhs, in_dtype): + def call_scalar(self, space, w_lhs, w_rhs, casting): + in_dtype, out_dtype, func = self.find_specialization( + space, w_lhs.get_dtype(space), w_rhs.get_dtype(space), + out=None, casting=casting) w_val = self.func(in_dtype, w_lhs.convert_to(space, in_dtype), w_rhs.convert_to(space, in_dtype)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit