Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'sure,': 0.09; 'am,': 0.12; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; '3:51': 0.16; 'different,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lookup': 0.16; 'subject:independent': 0.16; '\xa0in': 0.16; 'wrote:': 0.18; 'interesting.': 0.18; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'frequent': 0.23; 'sat,': 0.25; 'tree': 0.25; 'mine': 0.28; 'message-id:@mail.gmail.com': 0.28; '(since': 0.30; 'subject:?': 0.31; 'quite': 0.32; 'typically': 0.32; 'implement': 0.32; 'to:addr:python-list': 0.34; 'but,': 0.34; 'something': 0.35; 'received:google.com': 0.37; 'could': 0.37; 'cases,': 0.38; 'received:209.85': 0.38; 'i.e.': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'difference': 0.40; 'huge': 0.61; 'more': 0.61; '2011': 0.61; 'effective': 0.61; 'details': 0.65; 'access,': 0.74; 'marginally': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=a3T3OSMBjIckpwoBGJ/9adWjLS2YSJhQNSsNvHJEDek=; b=gD+UubrmiQmsxR3rekKxo8BMBKWeDLGm5h7cLpTX+eqmChLTZEBpCUBDoAjrqz9/Y3 UgvmFk3T3jBN4uXIo0dHKZxc7ufbzt5wOPoOPKZ0dNGRbLcylvWEkKmZbI08CS2XuoUA ykX0rNkLBC+m+sCOO2uW9qF3hHx0AzmNm25+E= MIME-Version: 1.0 In-Reply-To: <87ty59adtx.fsf@xemacs.org> References: <30715729.411.1322753732534.JavaMail.geo-discussion-forums@pret21> <4ED7A2CE.6070306@davea.name> <6366868.86.1322800180523.JavaMail.geo-discussion-forums@pret21> <87k46fb8pg.fsf@xemacs.org> <87aa78bfvv.fsf@xemacs.org> <87y5un9zs6.fsf@xemacs.org> <4ee1f093$0$29977$c3e8da3$5496439d@news.astraweb.com> <87ty59adtx.fsf@xemacs.org> Date: Sat, 10 Dec 2011 04:13:21 +1100 Subject: Re: order independent hash? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323450805 news.xs4all.nl 6938 [2001:888:2000:d::a6]:43048 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16925 On Sat, Dec 10, 2011 at 3:51 AM, Hrvoje Niksic wrote: > The case of dicts which require frequent access, such as those used to > implement namespaces, is different, and more interesting. =A0Those dicts > are typically quite small, and for them the difference between O(log n) > and O(1) is negligible in both theory (since n is "small", i.e. bounded) > and practice. =A0In fact, depending on the details of the implementation, > the lookup in a small tree could even be marginally faster. This is something where, I am sure, far greater minds than mine delve... but, would a splay tree be effective for name lookups? In most cases, you'll have a huge puddle of names of which you use the tiniest fraction; and a splay tree would, in effect, automatically optimize itself to handle tight loops. ChrisA