Re: [Cython] Supporting cython.operator in C

2016-06-02 Thread Robert Bradshaw
On Thu, Jun 2, 2016 at 1:06 PM, Jeroen Demeyer wrote: > On 2016-06-02 21:12, Robert Bradshaw wrote: >>> >>> "if isinstance(x, (int,long))", which is parsed as "if PyInt_Check(x) or >>> PyLong_Check(x)" is slightly slower than "if PyInt_Check(x) || >>> PyLong_Check(x)". >> >> That is very surprisin

Re: [Cython] Supporting cython.operator in C

2016-06-02 Thread Jeroen Demeyer
On 2016-06-02 21:12, Robert Bradshaw wrote: "if isinstance(x, (int,long))", which is parsed as "if PyInt_Check(x) or PyLong_Check(x)" is slightly slower than "if PyInt_Check(x) || PyLong_Check(x)". That is very surprising. How much slower? With GCC 4.9.3, roughly 4% for a simple loop like fo

Re: [Cython] Supporting cython.operator in C

2016-06-02 Thread Robert Bradshaw
On Thu, Jun 2, 2016 at 12:57 AM, Jeroen Demeyer wrote: > On 2016-06-02 05:43, Robert Bradshaw wrote: >>> >>> 2. "x || y" because Cython's "x or y" generates complicated code which >>> isn't >>> optimized as well as "x || y". >> >> I just tried using gcc -O3 and the resulting assembly is identical.

Re: [Cython] Supporting cython.operator in C

2016-06-02 Thread Jeroen Demeyer
On 2016-06-02 05:43, Robert Bradshaw wrote: 2. "x || y" because Cython's "x or y" generates complicated code which isn't optimized as well as "x || y". I just tried using gcc -O3 and the resulting assembly is identical. Well, that would depend on what x and y are. A very concrete example: "

Re: [Cython] Supporting cython.operator in C

2016-06-02 Thread Jeroen Demeyer
On 2016-06-02 05:43, Robert Bradshaw wrote: You can always define your own macro #define ASSIGN(a, b) (a = b). That's basically my whole point. This ASSIGN should be called cython.operator.assign. ___ cython-devel mailing list cython-devel@python.or