Re: profiling and optimizing

Discussion in 'Python' started by Peter Otten, Jul 31, 2012.

  1. Peter Otten

    Peter Otten Guest

    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 ;)
    Peter Otten, Jul 31, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dimitri Ognibene
    Replies:
    0
    Views:
    365
    Dimitri Ognibene
    Apr 25, 2006
  2. Kapil Khosla
    Replies:
    2
    Views:
    305
    Peter van Merkerk
    Jul 18, 2003
  3. Replies:
    1
    Views:
    89
    Mike Austin
    Mar 12, 2006
  4. Chris Angelico

    Re: profiling and optimizing

    Chris Angelico, Jul 31, 2012, in forum: Python
    Replies:
    0
    Views:
    120
    Chris Angelico
    Jul 31, 2012
  5. Stefan Behnel

    Re: profiling and optimizing

    Stefan Behnel, Jul 31, 2012, in forum: Python
    Replies:
    0
    Views:
    137
    Stefan Behnel
    Jul 31, 2012
Loading...

Share This Page