Vitja Makarov | 1 Jun 2011 16:26
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/1 mark florisson <markflorisson88@...>:
> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov@...> wrote:
>> Hi!
>>
>> Is bindings performance issue valuable?
>>
>> $ cat bindbench.pyx
>> def wo_bindings():
>>    pass
>>
>> def outer():
>>    def inner():
>>        pass
>>    return inner
>> with_bindings = outer()
>>
>> $ python
>>>>> import timeit
>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings, with_bindings',
repeat=1, number=100000000)
>> [6.169871807098389]
>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings, with_bindings',
repeat=1, number=100000000)
>> [4.609416961669922]
>>
>> PyCBindings makes it 1.3 (difference is about 15ns on my laptop) times
>> slower for CPython interpreter execution.
>> As CPython has some optimizations for CFunctions and PyCFunctions.
>>
>> Does it make sense for us? Or we can easily switch to bindings?
(Continue reading)

Robert Bradshaw | 2 Jun 2011 07:49
Favicon

Re: [Cython] Bindings performance issue

On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov
<vitja.makarov@...> wrote:
> 2011/6/1 mark florisson <markflorisson88@...>:
>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov@...> wrote:
>>> Hi!
>>>
>>> Is bindings performance issue valuable?
>>>
>>> $ cat bindbench.pyx
>>> def wo_bindings():
>>>    pass
>>>
>>> def outer():
>>>    def inner():
>>>        pass
>>>    return inner
>>> with_bindings = outer()
>>>
>>> $ python
>>>>>> import timeit
>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>> [6.169871807098389]
>>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings, with_bindings',
repeat=1, number=100000000)
>>> [4.609416961669922]
>>>
>>> PyCBindings makes it 1.3 (difference is about 15ns on my laptop) times
>>> slower for CPython interpreter execution.
>>> As CPython has some optimizations for CFunctions and PyCFunctions.
(Continue reading)

Vitja Makarov | 2 Jun 2011 10:30
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/2 Robert Bradshaw <robertwb@...>:
> On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov
<vitja.makarov@...> wrote:
>> 2011/6/1 mark florisson <markflorisson88@...>:
>>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov@...> wrote:
>>>> Hi!
>>>>
>>>> Is bindings performance issue valuable?
>>>>
>>>> $ cat bindbench.pyx
>>>> def wo_bindings():
>>>>    pass
>>>>
>>>> def outer():
>>>>    def inner():
>>>>        pass
>>>>    return inner
>>>> with_bindings = outer()
>>>>
>>>> $ python
>>>>>>> import timeit
>>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>> [6.169871807098389]
>>>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings, with_bindings',
repeat=1, number=100000000)
>>>> [4.609416961669922]
>>>>
>>>> PyCBindings makes it 1.3 (difference is about 15ns on my laptop) times
>>>> slower for CPython interpreter execution.
(Continue reading)

Robert Bradshaw | 2 Jun 2011 18:31
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 1:30 AM, Vitja Makarov
<vitja.makarov@...> wrote:
> 2011/6/2 Robert Bradshaw <robertwb@...>:
>> On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov
<vitja.makarov@...> wrote:
>>> 2011/6/1 mark florisson <markflorisson88@...>:
>>>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov@...> wrote:
>>>>> Hi!
>>>>>
>>>>> Is bindings performance issue valuable?
>>>>>
>>>>> $ cat bindbench.pyx
>>>>> def wo_bindings():
>>>>>    pass
>>>>>
>>>>> def outer():
>>>>>    def inner():
>>>>>        pass
>>>>>    return inner
>>>>> with_bindings = outer()
>>>>>
>>>>> $ python
>>>>>>>> import timeit
>>>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>> [6.169871807098389]
>>>>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>> [4.609416961669922]
>>>>>
(Continue reading)

mark florisson | 2 Jun 2011 22:00
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 2 June 2011 18:31, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
> On Thu, Jun 2, 2011 at 1:30 AM, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>> 2011/6/2 Robert Bradshaw <robertwb <at> math.washington.edu>:
>>> On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>>>> 2011/6/1 mark florisson <markflorisson88 <at> gmail.com>:
>>>>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>>>>>> Hi!
>>>>>>
>>>>>> Is bindings performance issue valuable?
>>>>>>
>>>>>> $ cat bindbench.pyx
>>>>>> def wo_bindings():
>>>>>>    pass
>>>>>>
>>>>>> def outer():
>>>>>>    def inner():
>>>>>>        pass
>>>>>>    return inner
>>>>>> with_bindings = outer()
>>>>>>
>>>>>> $ python
>>>>>>>>> import timeit
>>>>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>>> [6.169871807098389]
>>>>>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>>> [4.609416961669922]
>>>>>>
>>>>>> PyCBindings makes it 1.3 (difference is about 15ns on my laptop) times
(Continue reading)

Robert Bradshaw | 2 Jun 2011 22:16
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 1:00 PM, mark florisson
<markflorisson88@...> wrote:
> On 2 June 2011 18:31, Robert Bradshaw
<robertwb@...> wrote:
>> On Thu, Jun 2, 2011 at 1:30 AM, Vitja Makarov
<vitja.makarov@...> wrote:
>>> 2011/6/2 Robert Bradshaw <robertwb@...>:
>>>> On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov
<vitja.makarov@...> wrote:
>>>>> 2011/6/1 mark florisson <markflorisson88@...>:
>>>>>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov@...> wrote:
>>>>>>> Hi!
>>>>>>>
>>>>>>> Is bindings performance issue valuable?
>>>>>>>
>>>>>>> $ cat bindbench.pyx
>>>>>>> def wo_bindings():
>>>>>>>    pass
>>>>>>>
>>>>>>> def outer():
>>>>>>>    def inner():
>>>>>>>        pass
>>>>>>>    return inner
>>>>>>> with_bindings = outer()
>>>>>>>
>>>>>>> $ python
>>>>>>>>>> import timeit
>>>>>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>>>> [6.169871807098389]
(Continue reading)

mark florisson | 2 Jun 2011 23:03
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 2 June 2011 22:16, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
> On Thu, Jun 2, 2011 at 1:00 PM, mark florisson
> <markflorisson88 <at> gmail.com> wrote:
>> On 2 June 2011 18:31, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>> On Thu, Jun 2, 2011 at 1:30 AM, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>>>> 2011/6/2 Robert Bradshaw <robertwb <at> math.washington.edu>:
>>>>> On Wed, Jun 1, 2011 at 7:26 AM, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>>>>>> 2011/6/1 mark florisson <markflorisson88 <at> gmail.com>:
>>>>>>> On 31 May 2011 20:25, Vitja Makarov <vitja.makarov <at> gmail.com> wrote:
>>>>>>>> Hi!
>>>>>>>>
>>>>>>>> Is bindings performance issue valuable?
>>>>>>>>
>>>>>>>> $ cat bindbench.pyx
>>>>>>>> def wo_bindings():
>>>>>>>>    pass
>>>>>>>>
>>>>>>>> def outer():
>>>>>>>>    def inner():
>>>>>>>>        pass
>>>>>>>>    return inner
>>>>>>>> with_bindings = outer()
>>>>>>>>
>>>>>>>> $ python
>>>>>>>>>>> import timeit
>>>>>>>>>>> timeit.repeat('with_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
>>>>>>>> [6.169871807098389]
>>>>>>>>>>> timeit.repeat('wo_bindings()', setup='from bindbench import wo_bindings,
with_bindings', repeat=1, number=100000000)
(Continue reading)

Robert Bradshaw | 2 Jun 2011 23:13
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
<markflorisson88@...> wrote:

>>>> If anyone is assigning a Cython function to an object and then using
>>>> it they're counting on the current non-binding behavior, and it will
>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>> are for.
>>>
>>> If you're binding functions to classes without expecting it to ever
>>> bind, you don't really have bitching rights when stuff breaks later
>>> on. You should have been using staticmethod() to begin with. And we
>>> never said that our functions would never bind :)
>>
>> No, you're assigning it to an object, counting on being able to call
>> it later on. E.g. the following is legal (though contrived in this
>> example):
>>
>> sage: class A:
>> ....:     pass
>> ....:
>> sage: a = A()
>> sage: a.foo = max
>> sage: a.foo([1,2,3])
>> 3
>>
>> If instead of len, it was one of our functions, then it would be bad
>> to suddenly change the semantics, because it could still run but
>> produce bad answers (e.g. if we had implemented max, suddenly a would
>> be included in the comparison). This is why I proposed raising an
>> explicit error as an intermediate step.
(Continue reading)

mark florisson | 2 Jun 2011 23:21
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 2 June 2011 23:13, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
> <markflorisson88 <at> gmail.com> wrote:
>
>>>>> If anyone is assigning a Cython function to an object and then using
>>>>> it they're counting on the current non-binding behavior, and it will
>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>> are for.
>>>>
>>>> If you're binding functions to classes without expecting it to ever
>>>> bind, you don't really have bitching rights when stuff breaks later
>>>> on. You should have been using staticmethod() to begin with. And we
>>>> never said that our functions would never bind :)
>>>
>>> No, you're assigning it to an object, counting on being able to call
>>> it later on. E.g. the following is legal (though contrived in this
>>> example):
>>>
>>> sage: class A:
>>> ....:     pass
>>> ....:
>>> sage: a = A()
>>> sage: a.foo = max
>>> sage: a.foo([1,2,3])
>>> 3
>>>
>>> If instead of len, it was one of our functions, then it would be bad
>>> to suddenly change the semantics, because it could still run but
>>> produce bad answers (e.g. if we had implemented max, suddenly a would
>>> be included in the comparison). This is why I proposed raising an
(Continue reading)

Robert Bradshaw | 2 Jun 2011 23:34
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
<markflorisson88@...> wrote:
> On 2 June 2011 23:13, Robert Bradshaw
<robertwb@...> wrote:
>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>> <markflorisson88@...> wrote:
>>
>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>> are for.
>>>>>
>>>>> If you're binding functions to classes without expecting it to ever
>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>> never said that our functions would never bind :)
>>>>
>>>> No, you're assigning it to an object, counting on being able to call
>>>> it later on. E.g. the following is legal (though contrived in this
>>>> example):
>>>>
>>>> sage: class A:
>>>> ....:     pass
>>>> ....:
>>>> sage: a = A()
>>>> sage: a.foo = max
>>>> sage: a.foo([1,2,3])
>>>> 3
>>>>
>>>> If instead of len, it was one of our functions, then it would be bad
(Continue reading)

mark florisson | 2 Jun 2011 23:45
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 2 June 2011 23:34, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
> On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
> <markflorisson88 <at> gmail.com> wrote:
>> On 2 June 2011 23:13, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>>> <markflorisson88 <at> gmail.com> wrote:
>>>
>>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>>> are for.
>>>>>>
>>>>>> If you're binding functions to classes without expecting it to ever
>>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>>> never said that our functions would never bind :)
>>>>>
>>>>> No, you're assigning it to an object, counting on being able to call
>>>>> it later on. E.g. the following is legal (though contrived in this
>>>>> example):
>>>>>
>>>>> sage: class A:
>>>>> ....:     pass
>>>>> ....:
>>>>> sage: a = A()
>>>>> sage: a.foo = max
>>>>> sage: a.foo([1,2,3])
>>>>> 3
>>>>>
>>>>> If instead of len, it was one of our functions, then it would be bad
(Continue reading)

Robert Bradshaw | 2 Jun 2011 23:59
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 2:45 PM, mark florisson
<markflorisson88@...> wrote:
> On 2 June 2011 23:34, Robert Bradshaw
<robertwb@...> wrote:
>> On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
>> <markflorisson88@...> wrote:
>>> On 2 June 2011 23:13, Robert Bradshaw
<robertwb@...> wrote:
>>>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>>>> <markflorisson88@...> wrote:
>>>>
>>>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>>>> are for.
>>>>>>>
>>>>>>> If you're binding functions to classes without expecting it to ever
>>>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>>>> never said that our functions would never bind :)
>>>>>>
>>>>>> No, you're assigning it to an object, counting on being able to call
>>>>>> it later on. E.g. the following is legal (though contrived in this
>>>>>> example):
>>>>>>
>>>>>> sage: class A:
>>>>>> ....:     pass
>>>>>> ....:
>>>>>> sage: a = A()
>>>>>> sage: a.foo = max
(Continue reading)

mark florisson | 3 Jun 2011 00:04
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 2 June 2011 23:59, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
> On Thu, Jun 2, 2011 at 2:45 PM, mark florisson
> <markflorisson88 <at> gmail.com> wrote:
>> On 2 June 2011 23:34, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>> On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
>>> <markflorisson88 <at> gmail.com> wrote:
>>>> On 2 June 2011 23:13, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>>>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>>>>> <markflorisson88 <at> gmail.com> wrote:
>>>>>
>>>>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>>>>> are for.
>>>>>>>>
>>>>>>>> If you're binding functions to classes without expecting it to ever
>>>>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>>>>> never said that our functions would never bind :)
>>>>>>>
>>>>>>> No, you're assigning it to an object, counting on being able to call
>>>>>>> it later on. E.g. the following is legal (though contrived in this
>>>>>>> example):
>>>>>>>
>>>>>>> sage: class A:
>>>>>>> ....:     pass
>>>>>>> ....:
>>>>>>> sage: a = A()
>>>>>>> sage: a.foo = max
>>>>>>> sage: a.foo([1,2,3])
(Continue reading)

mark florisson | 3 Jun 2011 00:05
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 3 June 2011 00:04, mark florisson <markflorisson88 <at> gmail.com> wrote:
> On 2 June 2011 23:59, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>> On Thu, Jun 2, 2011 at 2:45 PM, mark florisson
>> <markflorisson88 <at> gmail.com> wrote:
>>> On 2 June 2011 23:34, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>>> On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
>>>> <markflorisson88 <at> gmail.com> wrote:
>>>>> On 2 June 2011 23:13, Robert Bradshaw <robertwb <at> math.washington.edu> wrote:
>>>>>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>>>>>> <markflorisson88 <at> gmail.com> wrote:
>>>>>>
>>>>>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>>>>>> are for.
>>>>>>>>>
>>>>>>>>> If you're binding functions to classes without expecting it to ever
>>>>>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>>>>>> never said that our functions would never bind :)
>>>>>>>>
>>>>>>>> No, you're assigning it to an object, counting on being able to call
>>>>>>>> it later on. E.g. the following is legal (though contrived in this
>>>>>>>> example):
>>>>>>>>
>>>>>>>> sage: class A:
>>>>>>>> ....:     pass
>>>>>>>> ....:
>>>>>>>> sage: a = A()
>>>>>>>> sage: a.foo = max
(Continue reading)

Robert Bradshaw | 3 Jun 2011 00:22
Favicon

Re: [Cython] Bindings performance issue

On Thu, Jun 2, 2011 at 3:04 PM, mark florisson
<markflorisson88@...> wrote:
> On 2 June 2011 23:59, Robert Bradshaw
<robertwb@...> wrote:
>> On Thu, Jun 2, 2011 at 2:45 PM, mark florisson
>> <markflorisson88@...> wrote:
>>> On 2 June 2011 23:34, Robert Bradshaw
<robertwb@...> wrote:
>>>> On Thu, Jun 2, 2011 at 2:21 PM, mark florisson
>>>> <markflorisson88@...> wrote:
>>>>> On 2 June 2011 23:13, Robert Bradshaw
<robertwb@...> wrote:
>>>>>> On Thu, Jun 2, 2011 at 2:03 PM, mark florisson
>>>>>> <markflorisson88@...> wrote:
>>>>>>
>>>>>>>>>> If anyone is assigning a Cython function to an object and then using
>>>>>>>>>> it they're counting on the current non-binding behavior, and it will
>>>>>>>>>> break. The speed is probably a lesser issue, which is what benchmarks
>>>>>>>>>> are for.
>>>>>>>>>
>>>>>>>>> If you're binding functions to classes without expecting it to ever
>>>>>>>>> bind, you don't really have bitching rights when stuff breaks later
>>>>>>>>> on. You should have been using staticmethod() to begin with. And we
>>>>>>>>> never said that our functions would never bind :)
>>>>>>>>
>>>>>>>> No, you're assigning it to an object, counting on being able to call
>>>>>>>> it later on. E.g. the following is legal (though contrived in this
>>>>>>>> example):
>>>>>>>>
>>>>>>>> sage: class A:
(Continue reading)

Vitja Makarov | 4 Jun 2011 12:24
Picon
Gravatar

Re: [Cython] Bindings performance issue

I've tried that: https://github.com/vitek/cython/compare/master..._bindings

Results are not bad: 168 failing tests for pyregr2.7 and 463 for py3

--

-- 
vitja.
mark florisson | 4 Jun 2011 12:58
Picon
Gravatar

Re: [Cython] Bindings performance issue

On 4 June 2011 12:24, Vitja Makarov <vitja.makarov@...> wrote:
> I've tried that: https://github.com/vitek/cython/compare/master..._bindings
>
> Results are not bad: 168 failing tests for pyregr2.7 and 463 for py3

Nice, it partly duplicates work in my fusedtypes branch but I suppose
it will have to be reworked anyway into a subclass. So this works only
for normal classes right, i.e. not for extension classes? It's also
pickle-able, cool :)

> --
> vitja.
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel
>
Vitja Makarov | 4 Jun 2011 13:17
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/4 mark florisson <markflorisson88@...>:
> On 4 June 2011 12:24, Vitja Makarov <vitja.makarov@...> wrote:
>> I've tried that: https://github.com/vitek/cython/compare/master..._bindings
>>
>> Results are not bad: 168 failing tests for pyregr2.7 and 463 for py3
>
> Nice, it partly duplicates work in my fusedtypes branch but I suppose
> it will have to be reworked anyway into a subclass.

Sure. I've taken some code from your branch ;)

> So this works only
> for normal classes right, i.e. not for extension classes? It's also
> pickle-able, cool :)
>

Yes. It works for python classes and python def functions.
__reduce__ only returns function name, so it's possible to
pickle/unpickle it in some cases
but that was enough to fix some broken tests from pyregr.

--

-- 
vitja.
Vitja Makarov | 20 Jun 2011 22:23
Picon
Gravatar

Re: [Cython] Bindings performance issue

Wow now we have about 11K tests with 171 errors!

https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/

--

-- 
vitja.
Stefan Behnel | 21 Jun 2011 08:50
Picon
Favicon

Re: [Cython] Bindings performance issue

Vitja Makarov, 20.06.2011 22:23:
> Wow now we have about 11K tests with 171 errors!
>
> https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/

Yes, that was a low hanging, high value bug.

"""
Make cyfunction __name__ attribute writable
"""

Could you provide a pull request with that change?

Thanks!

Stefan
Vitja Makarov | 21 Jun 2011 09:07
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/21 Stefan Behnel <stefan_ml@...>:
> Vitja Makarov, 20.06.2011 22:23:
>>
>> Wow now we have about 11K tests with 171 errors!
>>
>>
>> https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/
>
> Yes, that was a low hanging, high value bug.
>
> """
> Make cyfunction __name__ attribute writable
> """
>
> Could you provide a pull request with that change?
>

Do you mean single change or whole branch?

--

-- 
vitja.
Vitja Makarov | 21 Jun 2011 09:11
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/21 Vitja Makarov <vitja.makarov@...>:
> 2011/6/21 Stefan Behnel <stefan_ml@...>:
>> Vitja Makarov, 20.06.2011 22:23:
>>>
>>> Wow now we have about 11K tests with 171 errors!
>>>
>>>
>>> https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/
>>
>> Yes, that was a low hanging, high value bug.
>>
>> """
>> Make cyfunction __name__ attribute writable
>> """
>>
>> Could you provide a pull request with that change?
>>
>
> Do you mean single change or whole branch?
>

This commit
https://github.com/vitek/cython/commit/7b4471bcc5eeb09b2e4851d3a1c2c3d2a5bd085c

disables bindings for inner functions and breaks closure_decorators_T478 test.

I can remove that or fix testcase.

--

-- 
vitja.
(Continue reading)

Stefan Behnel | 21 Jun 2011 09:27
Picon
Favicon

Re: [Cython] Bindings performance issue

Vitja Makarov, 21.06.2011 09:07:
> 2011/6/21 Stefan Behnel:
>> Vitja Makarov, 20.06.2011 22:23:
>>>
>>> Wow now we have about 11K tests with 171 errors!
>>>
>>> https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/
>>
>> Yes, that was a low hanging, high value bug.
>>
>> """
>> Make cyfunction __name__ attribute writable
>> """
>>
>> Could you provide a pull request with that change?
>
> Do you mean single change or whole branch?

Hmm, I didn't look at the other changes in the branch yet. Actually, I 
followed the link in Jenkins and the changeset page didn't even show me 
which branch it was. This one, I guess:

https://github.com/vitek/cython/commits/_bindings

I'll give it a review when I get to it.

Do you think this branch is ready for a merge, or is there more to be done?

Stefan
(Continue reading)

Vitja Makarov | 21 Jun 2011 09:34
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/21 Stefan Behnel <stefan_ml@...>:
> Vitja Makarov, 21.06.2011 09:07:
>>
>> 2011/6/21 Stefan Behnel:
>>>
>>> Vitja Makarov, 20.06.2011 22:23:
>>>>
>>>> Wow now we have about 11K tests with 171 errors!
>>>>
>>>>
>>>> https://sage.math.washington.edu:8091/hudson/view/cython-vitek/job/cython-vitek-tests-pyregr-py27-c/
>>>
>>> Yes, that was a low hanging, high value bug.
>>>
>>> """
>>> Make cyfunction __name__ attribute writable
>>> """
>>>
>>> Could you provide a pull request with that change?
>>
>> Do you mean single change or whole branch?
>
> Hmm, I didn't look at the other changes in the branch yet. Actually, I
> followed the link in Jenkins and the changeset page didn't even show me
> which branch it was. This one, I guess:
>
> https://github.com/vitek/cython/commits/_bindings
>
> I'll give it a review when I get to it.
>
(Continue reading)

Vitja Makarov | 2 Jun 2011 22:06
Picon
Gravatar

Re: [Cython] Bindings performance issue

2011/6/2 Robert Bradshaw <robertwb@...>:
>> Initially bindings was written to support bound class methods (am I right?)
>> So when we use it for regular functions 'binding' in the name doesn't
>> reflect its purpose.
>
> There's three kinds of functions we create: PyCFunctions, binding
> PyCFunctions, and extension class methods (via descriptors). I was
> asking about the latter.
>
> As for the first two, it reflects the difference in behavior. If I
> take the function and assign it to a class, it will bind as a method
> when I go to look it up. This is arguably the biggest difference
> between built-in functions and Python functions.
>
>> One the other hand it's much more easy to write manually.
>>
>> About staticmethods: I think that CyFunction type should handle it as well
>> because staticmethods can have custom attributes and act just like
>> normal def one.
>>
>> The difference is insde descr_get it should return bound method for
>> normal and self for staticmethods.
>
> Yep. Does that merit a new class, or a flag that's checked on every
> function invocation (false 99.9% of the time)?
>

tp_descr_get() is called each time function gets bound, isn't so?
If it makes sens we can create both CyFunction and CyStaticFunction types.

(Continue reading)


Gmane