Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16373

Re: Does py2app improves speed?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!eweka.nl!lightspeed.eweka.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'architect': 0.03; 'subject:Does': 0.04; 'algorithms,': 0.07; 'function,': 0.07; 'pypy': 0.07; 'reason.': 0.07; 'executed': 0.09; "he'd": 0.09; 'subject:py2app': 0.09; 'am,': 0.12; 'developer': 0.12; 'processor': 0.15; '(eg.': 0.16; 'complained': 0.16; 'did.': 0.16; 'egotistical': 0.16; 'half.': 0.16; 'optimizing': 0.16; 'received:192.168.1.104': 0.16; 'rewrote': 0.16; 'cc:addr:python- list': 0.16; 'language': 0.17; 'wrote:': 0.18; '(perhaps': 0.18; 'rewrite': 0.18; 'say,': 0.19; 'cc:no real name:2**0': 0.20; 'appropriate': 0.22; 'wrote': 0.22; 'asked': 0.22; 'header:In- Reply-To:1': 0.22; 'wonder': 0.23; 'interface': 0.23; 'alan': 0.23; 'algorithms.': 0.23; 'cc:2**0': 0.24; 'libraries': 0.24; 'obviously': 0.25; 'code': 0.25; 'guess': 0.26; 'code.': 0.26; 'thanks.': 0.26; 'function': 0.27; 'fix': 0.27; 'all,': 0.28; 'coding': 0.28; 'tools,': 0.28; "wasn't": 0.28; 'replaced': 0.29; 'fixed': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'lines': 0.30; 'agreed.': 0.30; 'ago': 0.31; 'subject:?': 0.31; "didn't": 0.31; 'developers': 0.32; 'about.': 0.32; 'list': 0.32; 'programmers': 0.32; 'stopped': 0.32; 'header:User-Agent:1': 0.33; 'instead': 0.33; 'there': 0.33; 'agree': 0.33; 'someone': 0.34; 'loop': 0.34; 'certain': 0.34; 'things': 0.34; 'all.': 0.34; 'anything': 0.34; 'assignment': 0.34; 'measure': 0.34; 'rest': 0.35; 'project': 0.35; '...': 0.36; 'but': 0.37; 'run': 0.37; 'list,': 0.37; 'received:192': 0.37; 'another': 0.37; 'think': 0.37; 'could': 0.37; 'enough': 0.38; 'several': 0.38; 'couple': 0.38; 'ways': 0.39; 'being': 0.39; 'else': 0.39; 'everyone': 0.39; 'why': 0.39; 'help': 0.39; 'called': 0.40; 'week.': 0.40; 'received:192.168': 0.40; 'once': 0.60; 'within': 0.60; 'more': 0.61; 'design': 0.61; 'total': 0.61; 'your': 0.61; 'subject': 0.62; 'choose': 0.62; 'customer': 0.65; 'minutes': 0.66; 'making': 0.67; 'it)': 0.67; 'saw': 0.67; '4th': 0.68; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'day.': 0.72; 'learned': 0.73; 'profile': 0.73; 'to:addr:yahoo.com': 0.83; 'code;': 0.84; 'different.': 0.84; 'happy.': 0.84; 'imagined': 0.84; 'measuring': 0.84; 'dreamed': 0.91; 'meyer': 0.91; 'scenario': 0.93
Date Mon, 28 Nov 2011 22:53:14 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15
MIME-Version 1.0
To Alan Meyer <ameyer2@yahoo.com>
Subject Re: Does py2app improves speed?
References <0F07657D-9C87-417E-ADCB-150EB5040CAF@gmail.com> <CALwzidnD-hP-NQouJtfJLNLOsm7Sp5cZ_AA1cnLWcBUNKpv6AA@mail.gmail.com> <3F9F123B-4A94-46C7-9184-2D0EF7F3A27C@gmail.com> <4ECE48E3.6070701@davea.name> <432E5AEC-F306-4043-B28D-AF4213F0526E@gmail.com> <mailman.3006.1322144862.27778.python-list@python.org> <4ED3E901.30306@yahoo.com>
In-Reply-To <4ED3E901.30306@yahoo.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:aHvS3j5QE4pRDyePz94rFZuDRPo4TTKUkIX6e24Qb/X P1ey8ajzBaH7a6BQnGl168dhUMhVIz2z8zJAc1KsHSpj37WT7e 7WOQOrLZbivNJzuMw6ZycigAEkJgVeBkE04eb7hMNLp9j/YIsa 3drmdPQSLPEkCQ2vrpQonig9cNlsP91yYdwvhJV/H5vqJQBU/M 8bq30UOn2zUES4nlCOgh5lqInqmcPhWVWOA+Ntoj0MYnOLQs1I WrKKd3kzyJIbzdWyGhcYWUfNAt0D82FMV4qs8aqiniYJWd69rg XD3ZHCWMXw+V+8lVqo1QqWN1Zk5SJsD3k7zw+LQFvQseIuUmw= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3115.1322538825.27778.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1322538825 news.xs4all.nl 6868 [2001:888:2000:d::a6]:48728
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16373

Show key headers only | View raw


On 11/28/2011 03:03 PM, Alan Meyer wrote:
> On 11/24/2011 9:27 AM, Dave Angel wrote:
> ...
>> Several ways to speed up code.
>>
>> 1) use language features to best advantage
>> 2) use 3rd party libraries that do certain things well
>> 3) use best algorithms, subject to #1 and #2
>> 4) have someone else review the code (perhaps on the list, perhaps
>> within your own organization)
>> 5) measure (eg. profile it)
>> 6) use optimizing tools, such as pypy or Cython.
>> 7) rewrite parts of it in another language
>> 8) get a faster processor
>> 9) rewrite it all in another language
>>
>> It takes experience to choose between these, and each project is
>> different. But even the most experienced developers will frequently
>> guess entirely wrong where the bottleneck is, which is why you measure
>> if you care.
>
> I agree that measuring (profiling) is the most critical.
>
> As you say, even the most experienced programmers can guess wrong.  
> The first time I used a profiler a couple of decades ago I was 
> egotistical enough to wonder how this thing could help me.  After all, 
> I wrote the code.  I knew what it did.  The profiler wasn't going to 
> tell me anything I didn't know.
>
> I learned  a little humility after reading the profiler output.  The 
> program was spending most of its time in a place that I never dreamed 
> was a problem, and a 10 minute fix cut run times in half.
>
> In that particular case there wasn't even a design problem, it was 
> just a procedure call inside a tight loop that executed far more often 
> than I imagined and could be replaced with a few lines of inline code.
>
> I think the rest of your list is excellent too.
>
>     Alan

Thanks.  I once had an assignment to speed up a function implementation 
which was obviously slow (I had noted the same thing to the architect 
when I first saw the code;  it would definitely be slow on large data 
sets).  I knew faster algorithms.  But I stopped instead to measure how 
many times it was being called in the particularly slow scenario that 
the customer complained about.  Turns out it wasn't being called at 
all.  I asked the appropriate developer why he had chosen to do it 
another way (expecting he'd say because he knew this function was slow), 
and he gave me an entirely different reason.  I asked him whether he'd 
be willing to call this function if I fixed his complaint about its 
interface, and he agreed.

Now, I rewrote the function, making a change to tighten its interface 
restrictions.  And it cut the customer's wait time from 90 minutes to 
2.  Everyone was happy.

Total time spent, a week.  But I didn't start coding till the 4th day.


-- 

DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Does py2app improves speed? Dave Angel <d@davea.name> - 2011-11-24 09:27 -0500
  Re: Does py2app improves speed? Alan Meyer <ameyer2@yahoo.com> - 2011-11-28 15:03 -0500
    Re: Does py2app improves speed? Dave Angel <d@davea.name> - 2011-11-28 22:53 -0500

csiph-web