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


Groups > comp.lang.python > #94438

Re: Optimizing if statement check over a numpy value

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lac@openend.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'lookups': 0.16; 'message- id:@fido.openend.se': 0.16; 'mylist': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'useless': 0.16; 'laura': 0.18; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'header:In-Reply-To:1': 0.24; 'values': 0.28; 'fast.': 0.29; 'improves': 0.29; 'received:se': 0.29; 'url:activestate': 0.29; 'cc:no real name:2**1': 0.29; 'url:code': 0.34; 'could': 0.35; 'instead': 0.36; 'possible': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'list.': 0.37; 'things': 0.38; 'enough': 0.39; 'well.': 0.40; 'collection': 0.60; 'header :Message-Id:1': 0.61; 'you.': 0.64; 'received:89': 0.80; 'subject:check': 0.84; 'subject:over': 0.84; 'subject:value': 0.84; 'tree,': 0.84; 'url:recipes': 0.84
To Heli Nix <hemla21@gmail.com>
cc python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: Optimizing if statement check over a numpy value
In-Reply-To Message from Heli Nix <hemla21@gmail.com> of "Thu, 23 Jul 2015 02:21:33 -0700." <65c45685-dee1-41f8-a16a-7a062f4e7b02@googlegroups.com>
References <65c45685-dee1-41f8-a16a-7a062f4e7b02@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <19211.1437646401.1@fido>
Date Thu, 23 Jul 2015 12:13:21 +0200
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Thu, 23 Jul 2015 12:13:31 +0200 (CEST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.908.1437646424.3674.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1437646424 news.xs4all.nl 2893 [2001:888:2000:d::a6]:32812
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:94438

Show key headers only | View raw


Take a look at the sorted collection recipe:
http://code.activestate.com/recipes/577197-sortedcollection/

You want myList to be a sorted List.  You want lookups to be fast.

See if that improves things enough for you.  It may be possible to
have better speedups if instead of myList you write myTree and store
the values in a tree, depending on what the values of id are --  it
could be completely useless for you, as well.

Laura

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


Thread

Optimizing if statement  check over a numpy value Heli Nix <hemla21@gmail.com> - 2015-07-23 02:21 -0700
  Re: Optimizing if statement check over a numpy value MRAB <python@mrabarnett.plus.com> - 2015-07-23 10:55 +0100
  Re: Optimizing if statement check over a numpy value Laura Creighton <lac@openend.se> - 2015-07-23 12:13 +0200
  Re: Optimizing if statement  check over a numpy value Jeremy Sanders <jeremy@jeremysanders.net> - 2015-07-23 13:42 +0200
    Re: Optimizing if statement  check over a numpy value Heli Nix <hemla21@gmail.com> - 2015-07-29 07:23 -0700

csiph-web