Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Pyhon 2.x or 3.x, which is faster? Date: Tue, 8 Mar 2016 12:40:50 +1100 Lines: 51 Message-ID: References: <87d1r6iltx.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 6U2IUIlbwn3OA6pzkhkAFwqguuM/Zhi9HesCSwDkfmbA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'heavily': 0.04; 'startup': 0.05; 'skip:/ 10': 0.07; 'cc:addr:python-list': 0.09; 'mercurial': 0.09; 'subject:which': 0.09; 'python': 0.10; 'def': 0.13; 'interpreter': 0.15; '2.7:': 0.16; '2.7?': 0.16; '2016': 0.16; 'code?': 0.16; 'first:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'matters,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'time.time()': 0.16; 'version?': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'handles': 0.20; '3.x': 0.22; 'pass': 0.22; 'appears': 0.23; 'nearly': 0.23; 'header:In-Reply- To:1': 0.24; 'requests': 0.25; 'module': 0.25; 'chris': 0.26; 'compare': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'concern': 0.29; 'measure': 0.29; 'code:': 0.29; 'code': 0.30; 'compared': 0.30; 'putting': 0.30; 'seconds': 0.31; 'another': 0.32; "can't": 0.32; 'useful': 0.33; 'idle': 0.33; '(for': 0.34; 'tue,': 0.34; 'file': 0.34; 'running': 0.34; 'received:google.com': 0.35; 'clear': 0.35; 'execution': 0.35; 'something': 0.35; 'there': 0.36; 'received:209.85': 0.36; 'depends': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'doing': 0.38; 'version': 0.38; 'received:209': 0.38; 'someone': 0.38; 'mean': 0.38; 'why': 0.39; 'does': 0.39; 'ten': 0.60; 'care': 0.60; 'your': 0.60; 'yes': 0.62; 'course': 0.62; 'more': 0.63; 'here:': 0.63; 'mar': 0.65; '3.4': 0.84; '8.4': 0.84; 'chrisa': 0.84; 'cripple': 0.84; 'measure.': 0.84; 'to:none': 0.91 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:cc; bh=qC+GzP0QFOCJQ1X3Rb1WDYorPYhn1QpJAVoB6KIg4os=; b=cLhtJmstnwErnukEn23qKKwIJhxljaXyI+46iEZuyR3Fj0IY+98bXsMiILSQ41/WWK qRSVD4bisK632A9iHk6SuaD+VTxSlWY2zdV3jqP9mZzSNJaciygBpWu0PJIk7uCtKqrO kATS+Lmi/H0nEfyhXMsehqCixr0Ilr54De1HH5G40T7noTx+rNOCXO46v0VujJmlNJpN wUbPmumkCnjhe8XYWTWZIl079FAiNLhuhHQn1vc0PrqbW1M6jvZzL6I8x9pqWzZArEFt WxfhTGBLah5RIDHeEtamuWgxpIALFOebCiVcFDJ3EOl4LHsn9LqArATj5ZqsBUNgVJ6M F0TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=qC+GzP0QFOCJQ1X3Rb1WDYorPYhn1QpJAVoB6KIg4os=; b=TYv8Mvc7tvw6bKzURHGhg0eQJTm8U53KbpncbgYQCl9Opku2fc4hN/7MU//QhD3+hK NiVcu+8e4yW7EtyFKloFyIgZkzWNrnAftZWDbYuxRFqns25qOV81gq+LsCyq8GZQNfZN 4eHW22S6FWoLWC3NyLKKWbLJJM7qj5tsdbfDg03CTPTfvDhlaKgvnkO+5F9JPsiGEUyb WomrLfjh2SVzPrp0+3oNVt075keVzM0GSCrq1rV7xZ41Dv6sDyEKMuB1ReJyVfE5ol0g giTQKx+pXINAaSqNoxp5aD9SCGYz6zaaSHOqxVmQ/JMKTIJCgdovpOH0MgJCbZsyxxGF ZdEw== X-Gm-Message-State: AD7BkJLihF+d5uXZ+/zvb7CFaZjr8tMoXZbSY0S8gM9wa5yMNQVHr/gmDpAyFn84Khr+261ToGcK9hMtSlkokQ== X-Received: by 10.50.57.11 with SMTP id e11mr15348743igq.13.1457401250860; Mon, 07 Mar 2016 17:40:50 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104302 On Tue, Mar 8, 2016 at 12:33 PM, BartC wrote: > On 08/03/2016 01:23, Chris Angelico wrote: >> >> On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: >>> >>> Yes of course it does. As does 'being slow'. Take another microbenchmark: >>> >>> def whiletest(): >>> | i=0 >>> | while i<=100000000: >>> | | i+=1 >>> >>> whiletest() >>> >>> Python 2.7: 8.4 seconds >>> Python 3.1: 12.5 seconds >>> Python 3.4: 18.0 seconds >>> >>> Even if you don't care about speed, you must admit that there appears to >>> be >>> something peculiar going on here: why would 3.4 take more than twice as >>> long >>> as 2.7? What do they keep doing to 3.x to cripple it on each new version? >> >> >> How do your benchmarks compare on this code: >> >> pass > > > Let me ask you a follow-on question first: how slow does a new Python > version have to be before even you would take notice? > > Compared with 2.7, 3.4 above is spending nearly an extra ten seconds doing > .... what? I can't understand why someone just wouldn't care. Performance matters, when you actually have something useful to measure. Startup performance matters enormously if interpreter startup is what you're doing a lot of (for example, the "feel" of Mercurial depends heavily on Python startup performance). It matters not a whit if your process keeps running for a long time, and handles many requests (for example, a web server). You need to be VERY clear about exactly what you're measuring. Are you using the 'timeit' module to measure execution of one line of code? Are you putting your code into a file and running that with /usr/bin/time? Are you putting the code into Idle and running it in a loop with 'exec' and using time.time() around the outside? Your numbers do not concern me *because they mean nothing*. ChrisA