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


Groups > comp.lang.python > #32143

Re: bit count or bit set && Python3

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.albasani.net!news.musoftware.de!wum.musoftware.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'subject:Python3': 0.09; 'subject:set': 0.09; 'bitwise': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'oct': 0.16; 'subject:bit': 0.16; 'think?': 0.16; 'wrote:': 0.17; 'meant': 0.21; 'operations.': 0.22; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'clever': 0.29; "d'aprano": 0.29; 'steven': 0.29; 'fri,': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'faster': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'skip:4 10': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'times': 0.63; 'six': 0.65; '26,': 0.65; '600': 0.71; 'rusi': 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:to :content-type; bh=FgUFzQ4Qyk4crr6GPwfjawbPCwNRjbBYQfhKFV0G26o=; b=OOnFzeLLTO804qKRhHMg4YYdOlMDhCP/Q4tn9r8Qdbag6oIay0XI27XKipMXGBtmOF Pgafluj/2hT+kXl1f0GLqqpOkZXOjX7y9ZA3C9TxHXiL966jk0YB9CcEBbkva+uDuiGV YxbboCdObn9YFqzk8M7BM7LzZSP6ytCwtv3coqkq3mX+H+i439X6XfAH0/AVXDuHBSwi rHxMMDx9V2LNV26FcU6lBJJCaTt202Gka/GIIvYwEbVD4XokHz+KxtaPiZbaM6VeOktE sSN8pBww4Q6HaiQyBsVPdLuynLmSBBvO0OoPodYej5v05uEc8UJOOMBopE+OkJ8vSelo 12eQ==
MIME-Version 1.0
In-Reply-To <41338e78-a3d9-4ab6-ab53-79ded90411c6@vy11g2000pbb.googlegroups.com>
References <5089511E.4090009@earthlink.net> <k6bllq$3gt$1@ger.gmane.org> <mailman.2849.1351179123.27098.python-list@python.org> <50896152$0$29978$c3e8da3$5496439d@news.astraweb.com> <41338e78-a3d9-4ab6-ab53-79ded90411c6@vy11g2000pbb.googlegroups.com>
Date Fri, 26 Oct 2012 03:29:37 +1100
Subject Re: bit count or bit set && Python3
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2852.1351182588.27098.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351182588 news.xs4all.nl 6989 [2001:888:2000:d::a6]:47466
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32143

Show key headers only | View raw


On Fri, Oct 26, 2012 at 3:17 AM, rusi <rustompmody@gmail.com> wrote:
> On Oct 25, 8:57 pm, Steven D'Aprano <steve
> +comp.lang.pyt...@pearwood.info> wrote:
>> py> min(t.repeat(number=10000, repeat=7))
>> 0.6819710731506348
>> py> min(t.repeat(number=100, repeat=7))
>> 4.141788959503174
>>
>> That makes the "inelegant" solution using bin() and count() about 600
>> times faster than the mathematically clever solution using bitwise
>> operations.
>
> You meant 600% I think?

It took six times longer to do one hundredth the iterations.

ChrisA

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


Thread

Re: bit count or bit set && Python3 Chris Angelico <rosuav@gmail.com> - 2012-10-26 02:31 +1100
  Re: bit count or bit set && Python3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-25 15:57 +0000
    Re: bit count or bit set && Python3 rusi <rustompmody@gmail.com> - 2012-10-25 09:17 -0700
      Re: bit count or bit set && Python3 Chris Angelico <rosuav@gmail.com> - 2012-10-26 03:29 +1100
        Re: bit count or bit set && Python3 rusi <rustompmody@gmail.com> - 2012-10-25 09:37 -0700
      Re: bit count or bit set && Python3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-25 17:44 +0100
      Re: bit count or bit set && Python3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-25 17:16 +0000
    Re: bit count or bit set && Python3 Serhiy Storchaka <storchaka@gmail.com> - 2012-10-25 22:07 +0300
    Re: bit count or bit set && Python3 Neil Cerutti <neilc@norwich.edu> - 2012-10-25 20:00 +0000
      Re: bit count or bit set && Python3 Neil Cerutti <neilc@norwich.edu> - 2012-10-25 20:04 +0000
      Re: bit count or bit set && Python3 Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-25 14:20 -0600
        Re: bit count or bit set && Python3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-25 23:48 +0000
        Re: bit count or bit set && Python3 Neil Cerutti <neilc@norwich.edu> - 2012-10-26 12:56 +0000
    Re: bit count or bit set && Python3 Charles Hixson <charleshixsn@earthlink.net> - 2012-10-25 09:08 -0700
    Re: bit count or bit set && Python3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-25 22:51 +0100

csiph-web