On Wed, 27 Feb 2013 21:49:04 +1100, Chris Angelico wrote:
> On Wed, Feb 27, 2013 at 9:36 PM, Robin Becker
> wrote:
>> However, in my case the method takes
>>
>>
>>
>> py C
>> utf8 bytes50 20 usec
>> unicode 39 15
>>
>> here py refers to a native
On 27/02/2013 11:14, Peter Otten wrote:
I think you misunderstood. You compare the time it takes to run the function
coded in C and its Python equivalent -- that difference is indeed
significant.
indeed. The function call overhead there looks pretty small so perhaps that's
the way fo
Robin Becker wrote:
> On 26/02/2013 18:38, Peter Otten wrote:
>> Robin Becker wrote:
> ...3:
>>
>> $ python -m timeit -s 'from new import instancemethod
>>> from math import sqrt
>>> class A(int): pass
>>> A.m = instancemethod(sqrt, None, A)
>>> a = A(42)
>>> ' 'a.m()'
>> 100 loops, be
On 27/02/2013 10:49, Chris Angelico wrote:
On Wed, Feb 27, 2013 at 9:36 PM, Robin Becker wrote:
However, in my case the method takes
py C
utf8 bytes50 20 usec
unicode 39 15
here py refers to a native python method and C to the extension m
On Wed, Feb 27, 2013 at 9:36 PM, Robin Becker wrote:
> However, in my case the method takes
>
>
>
> py C
> utf8 bytes50 20 usec
> unicode 39 15
>
> here py refers to a native python method and C to the extension method
> after adding to the class
On 26/02/2013 18:38, Peter Otten wrote:
Robin Becker wrote:
...3:
$ python -m timeit -s 'from new import instancemethod
from math import sqrt
class A(int): pass
A.m = instancemethod(sqrt, None, A)
a = A(42)
' 'a.m()'
100 loops, best of 3: 0.5 usec per loop
$ python -m timeit -s '
On Tue, 26 Feb 2013 17:21:16 +, Robin Becker wrote:
> In python 2 I was able to improve speed of reportlab using a C extension
> to optimize some heavily used methods.
>
> so I was able to do this
>
>
> class A:
> .
> def method(self,...):
>
>
>
> try:
> fr
Am 26.02.2013 21:19, schrieb Ethan Furman:
> Dumb question, but have you tried just assigning it? In Py3 methods are
> just normal functions...
>
> 8<--
> class A():
> pass
>
> A.method = c_method
> 8<--
That doesn't work with builtin functions
Ethan Furman wrote:
> On 02/26/2013 09:21 AM, Robin Becker wrote:
>> In python 2 I was able to improve speed of reportlab using a C extension
>> to optimize some heavily used methods.
>>
>> so I was able to do this
>>
>>
>> class A:
>> .
>> def method(self,...):
>>
>>
>>
On 02/26/2013 09:21 AM, Robin Becker wrote:
In python 2 I was able to improve speed of reportlab using a C extension to
optimize some heavily used methods.
so I was able to do this
class A:
.
def method(self,...):
try:
from extension import c_method
impo
Mark Lawrence wrote:
> On 26/02/2013 18:38, Peter Otten wrote:
>> Robin Becker wrote:
>>
>>> In python 2 I was able to improve speed of reportlab using a C extension
>>> to optimize some heavily used methods.
>>>
>>> so I was able to do this
>>>
>>>
>>> class A:
>>> .
>>> def metho
On 26/02/2013 18:38, Peter Otten wrote:
Robin Becker wrote:
In python 2 I was able to improve speed of reportlab using a C extension
to optimize some heavily used methods.
so I was able to do this
class A:
.
def method(self,...):
try:
from extension impo
Robin Becker wrote:
> In python 2 I was able to improve speed of reportlab using a C extension
> to optimize some heavily used methods.
>
> so I was able to do this
>
>
> class A:
> .
> def method(self,...):
>
>
>
> try:
> from extension import c_method
>
On 02/26/2013 12:21 PM, Robin Becker wrote:
In python 2 I was able to improve speed of reportlab using a C extension
to optimize some heavily used methods.
so I was able to do this
class A:
That creates an old-style class in Python 2.x. They've been obsolete
for many years. You want to d
In python 2 I was able to improve speed of reportlab using a C extension to
optimize some heavily used methods.
so I was able to do this
class A:
.
def method(self,...):
try:
from extension import c_method
import new
A.method = new.instancemethod(c_method,
15 matches
Mail list logo