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


Groups > comp.lang.python > #26307

Re: profiling and optimizing

From Peter Otten <__peter__@web.de>
Subject Re: profiling and optimizing
Date 2012-07-31 15:23 +0200
Organization None
References <CAOF-KfhcDaakdLFt0ZJqKAaY-6HiCQJmBP0x3jf08ytrWmhgew@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2777.1343741027.4697.python-list@python.org> (permalink)

Show all headers | 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