Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: python 3 problem: how to convert an extension method into a classMethod

Reply
Thread Tools

Re: python 3 problem: how to convert an extension method into a classMethod

 
 
Robin Becker
Guest
Posts: n/a
 
      02-27-2013
On 27/02/2013 10:49, Chris Angelico wrote:
> On Wed, Feb 27, 2013 at 9:36 PM, Robin Becker <(E-Mail Removed)> wrote:
>> However, in my case the method takes
>>
>>
>>
>> py C
>> utf8 bytes 50 20 usec
>> unicode 39 15
>>
>> here py refers to a native python method and C to the extension method
>> after adding to the class. Both are called via an instance of the class.

>
> Which raises the obvious question: Does it even matter? Will the
> saving of a few microseconds really make a difference? Python's best
> feature is its clarity of code, not its blazing performance; its
> performance goal is "fast enough", and for many MANY purposes, you
> won't be able to tell the difference between that and "awesome". Don't
> sacrifice your code's clarity to the little tin god of efficiency
> until you're sure you actually get something back.
>
> ChrisA
>

in fact this is the stringWidth function and it's used thousands of times. I
think when we did benchmark tests it came out as 1 or 2 as a cpu hog. Since it's
comparatively easy to code it's an obvious choice to move to C.
--
Robin Becker

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python 3 problem: how to convert an extension method into a classMethod Robin Becker Python 1 02-27-2013 04:46 AM
Re: python 3 problem: how to convert an extension method into a classMethod Peter Otten Python 0 02-26-2013 08:26 PM
Re: python 3 problem: how to convert an extension method into a classMethod Mark Lawrence Python 0 02-26-2013 07:33 PM
Re: python 3 problem: how to convert an extension method into a classMethod Peter Otten Python 0 02-26-2013 06:38 PM
Re: python 3 problem: how to convert an extension method into a classMethod Dave Angel Python 0 02-26-2013 05:52 PM



Advertisments