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


Groups > comp.lang.python > #26304

Re: profiling and optimizing

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.112
X-Spam-Level *
X-Spam-Evidence '*H*': 0.78; '*S*': 0.00; 'that?': 0.05; 'received:209.85.160.174': 0.07; '10:13': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.17; 'instance,': 0.17; '(or': 0.18; 'code.': 0.20; '31,': 0.22; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'cpu': 0.29; 'faster,': 0.29; 'no,': 0.29; 'normally': 0.30; 'function': 0.30; 'point': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'skip:p 20': 0.36; 'enough': 0.36; 'does': 0.37; 'why': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'internet,': 0.61; 'first': 0.61; 'fun': 0.64; 'it!': 0.64; 'making': 0.64; 'taking': 0.65; 'jul': 0.65; 'functions)': 0.84; 'moot': 0.84; 'rita': 0.91; 'reducing': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=D92EgHugAIgQbKi05OU7hYll2AyQPcSS0uDnG+Z7nhQ=; b=UxncQPS2LwN7+D1QI8zeePvOuAbZZUc/VrKhptY11gZe+QU1s1DlH5Qij1/Nqlag7n A0YLE5LjrZTsmmDNh6ESqq0NqyMOVnWNn542sE8S52SeVvRSEJa+D4kBunVGBx2r62X4 11r3bXmUm26zpPbc30iVgd+RqutCveFZc8uqLAnyfD//+eiUnelh0J6CRrWa2FhC5jBZ zCGZ+GDqmVCudYQV04NiMyA3q1Pnc529ZBsHOKcR+W4wZBOPhFZhyOebdA7ub6gY16xn DANjXP/Y26zIgMc7ThvDlzyT5a+DrcMRONzI+uPGExh+rlG0CeYG6vHLTMkbl/2zdTsS 6G4g==
MIME-Version 1.0
In-Reply-To <CAOF-KfhcDaakdLFt0ZJqKAaY-6HiCQJmBP0x3jf08ytrWmhgew@mail.gmail.com>
References <CAOF-KfhcDaakdLFt0ZJqKAaY-6HiCQJmBP0x3jf08ytrWmhgew@mail.gmail.com>
Date Tue, 31 Jul 2012 22:21:08 +1000
Subject Re: profiling and optimizing
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.2770.1343737272.4697.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343737272 news.xs4all.nl 6891 [2001:888:2000:d::a6]:42826
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26304

Show key headers only | View raw


On Tue, Jul 31, 2012 at 10:13 PM, Rita <rmorgan466@gmail.com> wrote:
> 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?

Why is the program deep-copying things? Rather than making deepcopy
faster, consider doing it less.

Normally I would first ask: Does the program even NEED optimization?
Often the answer is no, because it's already fast enough - for
instance, if it spends all its time waiting for the internet, there's
little point reducing its CPU footprint. However, that point is moot
in this instance, since you're doing the profiling/optimization for
education rather than performance :) Have fun with it!

Chris Angelico

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


Thread

Re: profiling and optimizing Chris Angelico <rosuav@gmail.com> - 2012-07-31 22:21 +1000

csiph-web