Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'lawrence': 0.09; 'measure': 0.09; 'cc:addr:python-list': 0.11; 'contest.': 0.16; 'count,': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'measured': 0.16; 'statement.': 0.16; 'string:': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'module': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'doc': 0.31; 'fri,': 0.33; 'created': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'instances': 0.36; 'does': 0.39; 'simple': 0.61; 'expectations': 0.74; 'to:addr:yahoo.co.uk': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=DFNMYYe+zJLPjLl/R5KaHSLR0hfhtGm1qtVw+yRGeTs=; b=RfDgPU2pNkcwL9189Q58+7hGcAR7Y6vL8Oo4rAI8iPHsztmP5kwtxlWEaHpWyb58yi Fqz89ksy3Stjj9Xj9J6p/uafxqpQ4Nwfn54NWznq28aJglfjQk9hvNG0atvoWyIzg+NP kdhGLt7Etf4K2HVaKrAhzodx4QNMkcLPHiq2D/sbLAlWwA0lhcUE7/cE+8JDxbTOE46n 2kkOCYXfLjiPMvP5+1CRxxKpvh2RrQ4k64k0aKbwdPUlZpLcw50n7B503QqHHPo2BwjQ mQkqGrU1i/EJO4WuUSyoWme1FsIeTIx7TLePztSewVN2oP5qGulswIpQuq/JhWNF+J78 pvOA== MIME-Version: 1.0 X-Received: by 10.42.15.70 with SMTP id k6mr22168519ica.53.1403885137181; Fri, 27 Jun 2014 09:05:37 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: References: <53acdd24$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 27 Jun 2014 11:05:37 -0500 X-Google-Sender-Auth: 71Q8BNaecDzJqqvM7OEzQ7mv6AE Subject: Re: print statements and profiling a function slowed performance From: Skip Montanaro To: Mark Lawrence Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1403885140 news.xs4all.nl 2867 [2001:888:2000:d::a6]:36735 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73660 On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence wrote: > Expectations don't count, measure it :) It's no contest. I have measured it (ages ago). The logging module does so many things that it's impossible for it to ever be as fast as a simple print statement. Look at the code in LogRecord.__init__. Then note the doc string: ... LogRecord instances are created every time something is logged. ... Skip