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


Groups > comp.lang.python > #26307

Re: profiling and optimizing

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'that?': 0.05; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'message- id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'respondents': 0.16; 'shallow': 0.16; 'wrote:': 0.17; 'tests': 0.18; '(or': 0.18; 'code.': 0.20; 'seems': 0.23; 'header:User-Agent:1': 0.26; 'replace': 0.27; 'header:X-Complaints-To:1': 0.28; 'function': 0.30; 'code': 0.31; 'to:addr:python-list': 0.33; 'there': 0.35; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'unit': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'different': 0.63; 'taking': 0.65; 'functions)': 0.84; 'rita': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: profiling and optimizing
Date Tue, 31 Jul 2012 15:23:56 +0200
Organization None
References <CAOF-KfhcDaakdLFt0ZJqKAaY-6HiCQJmBP0x3jf08ytrWmhgew@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084988f.dip.t-dialin.net
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
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.2777.1343741027.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343741027 news.xs4all.nl 6945 [2001:888:2000:d::a6]:43042
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26307

Show key headers only | View raw


Rita wrote:

> I recently inherented a large python process and everything is lovely. As
> a learning experience I would like to optimize the code so I ran it thru
> the profiler
> 
> python -m cProfile myscript.py
> 
> It seems majority of the time is taking in the deep copy but that seems to
> come from a function (or functions) in the code. Is there a way to
> optimize that? perhaps have a C implementation of the deep copy? Would
> that be feasible?

To give what the other respondents said a different angle: if you replace 
the deep with a shallow copy: do your unit tests start to fail? 

You don't have any? Add them before you start tinkering with the code ;)

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


Thread

Re: profiling and optimizing Peter Otten <__peter__@web.de> - 2012-07-31 15:23 +0200

csiph-web