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


Groups > comp.lang.python > #83202

Re: list comparison vs integer comparison, which is more efficient?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.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.080
X-Spam-Evidence '*H*': 0.85; '*S*': 0.01; 'cc:addr:python-list': 0.11; 'jan': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:which': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'looks': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'something': 0.35; 'received:google.com': 0.35; 'shorter': 0.36; 'subject:?': 0.36; 'pm,': 0.38; 'took': 0.61; 'subject:more': 0.64; '2015': 0.84; 'noise': 0.84; 'to:none': 0.92
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 :content-type; bh=p7jQBUt0eYxczJg4hP198/OA5Z8YNe4yqYmiUPB1etE=; b=vrxg93g4XZ4NR9IHYq17/ql7QoeHEG/xTpQB45Srk0veAh9q8d7eqGEHO5fgxO/O7p n6koT9CVqXfuvfvVf5Jx0l64N3/jqBHdIo7Yek0e6iEr9p411MxHw71HyYh5exl3W16z IfRG+LmbNzX3gWWL+ml8x/aiPg4BV0Vznsn31TUf2t/FwJDaMafSdW+DGdMR+dLIaO8b 7m+g0BzLG/TH0KfTLN37HTgarrLIdnVW4bV8vH18OzJJ6KdxLroK07xiu51jnwUQ6Fyx LtL3n0gGCPpU4qaP4tnoJc3aAtBXQ8eQYi8d8CT5hWHXTLPKSGWWTG5k+RvA2ZVtMq4V UV8g==
MIME-Version 1.0
X-Received by 10.50.79.200 with SMTP id l8mr6661988igx.14.1420374346550; Sun, 04 Jan 2015 04:25:46 -0800 (PST)
In-Reply-To <7968fa1c-9b4c-4d17-9f71-1bbc55392921@googlegroups.com>
References <d27586b9-017a-4519-a6bb-e0a1fac005d0@googlegroups.com> <mailman.17365.1420355468.18130.python-list@python.org> <5499f48c-26e3-41c5-8735-2641fde5f35e@googlegroups.com> <7968fa1c-9b4c-4d17-9f71-1bbc55392921@googlegroups.com>
Date Sun, 4 Jan 2015 23:25:46 +1100
Subject Re: list comparison vs integer comparison, which is more efficient?
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17370.1420374349.18130.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420374349 news.xs4all.nl 2854 [2001:888:2000:d::a6]:51064
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83202

Show key headers only | View raw


On Sun, Jan 4, 2015 at 11:17 PM, austin aigbe <eshikafe@gmail.com> wrote:
> However, it took a shorter time (0.004s) with 24 function calls than your code (0.005s) which took just 13 function calls to execute.
>
> Why is this?

That looks to me like noise in your stats. One ULP in timing stats?
Not something to base *anything* on.

ChrisA

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


Thread

list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-03 15:19 -0800
  Re: list comparison vs integer comparison, which is more efficient? Chris Angelico <rosuav@gmail.com> - 2015-01-04 10:40 +1100
  Re: list comparison vs integer comparison, which is more efficient? Terry Reedy <tjreedy@udel.edu> - 2015-01-04 02:10 -0500
    Re: list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-04 03:20 -0800
      Re: list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-04 04:17 -0800
        Re: list comparison vs integer comparison, which is more efficient? Christian Gollwitzer <auriocus@gmx.de> - 2015-01-04 13:22 +0100
          Re: list comparison vs integer comparison, which is more efficient? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-04 12:30 +0000
        Re: list comparison vs integer comparison, which is more efficient? Chris Angelico <rosuav@gmail.com> - 2015-01-04 23:25 +1100
        Re: list comparison vs integer comparison, which is more efficient? Jonas Wielicki <jonas@wielicki.name> - 2015-01-04 13:24 +0100

csiph-web