Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.104 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.00; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'pop()': 0.16; 'subject: \n ': 0.16; 'index': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header:User-Agent:1': 0.23; 'equivalent': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'end,': 0.31; 'lists?': 0.31; 'subject:end': 0.31; 'lists': 0.32; 'subject:the': 0.34; 'subject:from': 0.34; 'subject:with': 0.35; 'anywhere': 0.35; 'operations': 0.35; 'subject:lists': 0.35; 'words,': 0.36; 'subject:?': 0.36; 'should': 0.36; 'performance': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'removing': 0.60; 'impact': 0.61; 'received:173': 0.61; "you'll": 0.62; 'worth': 0.66; 'subject:. ': 0.67; 'believe': 0.68; 'optimized': 0.68; 'received:69.56': 0.68; 'subject:there': 0.68; 'impact.': 0.84; 'subject:long': 0.84; 'subject:Are': 0.93 Date: Sun, 22 Jun 2014 11:18:18 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Are there performance concerns with popping from front of long lists vs. the end of long lists? References: <1403460221.20360.131626817.5EFAE11B@webmail.messagingengine.com> In-Reply-To: <1403460221.20360.131626817.5EFAE11B@webmail.messagingengine.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Exim-ID: 1WymLL-0004Eo-7H X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:48699 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 1403462492 news.xs4all.nl 2865 [2001:888:2000:d::a6]:58497 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73504 On 06/22/2014 11:03 AM, python@bdurham.com wrote: > > Should I have any performance concerns with the index position used > to pop() values off of large lists? In other words, should pop(0) and > pop() be time equivalent operations with long lists? I believe lists are optimized for adding and removing items from the end, so anywhere else will have an impact. You'll have to do measurements to see if the impact is worth worrying about in your code. -- ~Ethan~