Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Mark Lawrence Newsgroups: comp.lang.python Subject: Re: Pyhon 2.x or 3.x, which is faster? Date: Fri, 11 Mar 2016 21:59:14 +0000 Lines: 32 Message-ID: References: <56df6761$0$1588$c3e8da3$5496439d@news.astraweb.com> <56e2579e$0$1608$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 2Yn61YvzgR/d7KKRnxFcdQ5EYP87E6w2J/DTS4YyvGIw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'append': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:which': 0.09; 'python': 0.10; 'def': 0.13; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'stumbling': 0.16; 'test()': 0.16; 'test():': 0.16; 'time).': 0.16; 'wrote:': 0.16; 'string': 0.17; 'programmer': 0.18; 'python?': 0.18; 'language': 0.19; 'work,': 0.21; 'lawrence': 0.22; 'minor': 0.22; 'bit': 0.23; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'header:User-Agent:1': 0.26; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'earlier': 0.27; 'correct': 0.28; 'this.': 0.28; 'extensively': 0.29; 'character': 0.29; 'print': 0.30; 'language.': 0.32; 'file': 0.34; 'growing': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'your': 0.60; 'charset:windows-1252': 0.62; 'making': 0.62; 'our': 0.64; 'today': 0.65; 'benchmark': 0.84; 'pythonistas,': 0.84; 'technique': 0.93 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 80.234.129.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 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:104649 On 11/03/2016 18:57, BartC wrote: > > Anyway, I've listed some of the stumbling blocks I think that Python has > in making it bit faster: http://pastebin.com/WfUfK3bc The String Append Benchmark This is a microbenchmark, but makes use of a technique I use extensively (creating a file for example by growing a string a character at a time). def test(): s="" for i in range(10000000): s+="*" print (len(s)) test() The minor snag that you might like to correct with your microbenchmark, which any experienced Python programmer knows, is that you *NEVER, EVER* create strings like this. Given that you've admitted earlier today that you couldn't get a simple slice to work, how much, if anything, do you actually know about Python? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence