Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'cpython': 0.05; 'tree': 0.05; 'pypy': 0.07; 'dan': 0.09; 'cc:addr:python- list': 0.11; 'email addr:python.org>': 0.11; 'sfxlen:2': 0.11; 'python': 0.11; '(ok,': 0.16; 'cc:name:python list': 0.16; 'dict': 0.16; 'project)': 0.16; 'reasonably': 0.16; 'wrote:': 0.18; 'backend': 0.19; "python's": 0.19; 'thu,': 0.19; 'written': 0.21; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'comparing': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'academic': 0.26; 'performing': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'properties': 0.29; 'wonder': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'that.': 0.31; 'depth': 0.31; 'subject:skip:i 10': 0.31; 'entirely': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'subject:?': 0.36; 'christian': 0.38; 'version,': 0.38; 'to:addr:python.org': 0.39; 'skip:n 10': 0.64; 'stand': 0.64; 'production': 0.68; 'response.': 0.68; 'optimized': 0.68; 'fact,': 0.69; 'study': 0.69; 'expectations': 0.74; 'subject:Red': 0.84; 'these.': 0.91; 'imagine': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Mg9OWr9nmgs4lxDpT92TOAR7AdOcBk+7Dvjb1cd3SuY=; b=mpd3mBAvKLc9HhIkLhYtrDPVWaZyGQg4XYkTR27r4zA3OGD3dYZkVIRtWk1z/g3feH erA2SL7Ss2ge/vzLnl7DugkGP+kEMEiXtTlz/UF68NYLWjo8KfYvjqWIvQTZgiMBzaBq UDbjfVvN1+vLrKOzjJRAHbS9CPb8dxfSxl80klG9R+gNfdK7RVJLIzcf5kv6iAwVvJI2 /zXVGZK1f/qOEhWvhydYtOs2iNZEigbnx3Wwxqx7cDTgcIONZZ++ZB5Le9tvmYEdJcfE ubh8ZSEKL716YPfUsNq+W0w6yUHB+BIinPy5gXZe7+QNUNdiM2hiQeNG+LrUQGcy5nuw mBUw== MIME-Version: 1.0 X-Received: by 10.50.88.36 with SMTP id bd4mr4021589igb.95.1367514247848; Thu, 02 May 2013 10:04:07 -0700 (PDT) In-Reply-To: <51824417.1@python.org> References: <51824417.1@python.org> Date: Thu, 2 May 2013 10:04:07 -0700 Subject: Re: Red Black Tree implementation? From: Dan Stromberg To: Christian Heimes Content-Type: multipart/alternative; boundary=089e013cc030f7eb6a04dbbf38e2 Cc: Python List 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: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367514257 news.xs4all.nl 15886 [2001:888:2000:d::a6]:55805 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44641 --089e013cc030f7eb6a04dbbf38e2 Content-Type: text/plain; charset=ISO-8859-1 On Thu, May 2, 2013 at 3:46 AM, Christian Heimes wrote: > Am 02.05.2013 01:11, schrieb Dan Stromberg: > No wonder it's getting slow and doesn't stand a change against Python's > dict implementation. The rbtree implementation from > newcenturycomputers.net is written entirely in Python. It's good code > for academic research in order to study the properties of a rbtree. > > If you need something production ready then you have to use an > implemetation with an optimized backend like a C code, PyPy or Cython. The newcenturycomputers RBTree is similarly slow on CPython 2.x, CPython 3.x, PyPy and Jython. I imagine the tree depth is getting deeper than it should, but I've not verified that. Also, the other datastructures I'm comparing it to: B+ Tree, AVL Tree, Treap, etcetera are pure python too, but they're performing reasonably - in fact, my expectations are pretty much defined by these. (OK, the treap code has a Cython version, but I'm not using that in this project) Thanks for the response. --089e013cc030f7eb6a04dbbf38e2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

= On Thu, May 2, 2013 at 3:46 AM, Christian Heimes <christian@python.org<= /a>> wrote:
Am 02.05.2013 01:11, schrieb Dan Stromberg:<= /blockquote>
=A0
No wonder it's getting slow and doesn't stand a change against Pyth= on's
dict implementation. The rbtree implementation from
newcenturycomp= uters.net is written entirely in Python. It's good code
for academic research in order to study the properties of a rbtree.

If you need something production ready then you have to use an
implemetation with an optimized backend like a C code, PyPy or Cython.

The newcenturycomputers RBTree is similarly slo= w on CPython 2.x, CPython 3.x, PyPy and Jython.=A0=A0 I imagine the tree de= pth is getting deeper than it should, but I've not verified that.=A0 Al= so, the other datastructures I'm comparing it to: B+ Tree, AVL Tree, Tr= eap, etcetera are pure python too, but they're performing reasonably - = in fact, my expectations are pretty much defined by these.

(OK, the treap code has a Cython version, but I'm not us= ing that in this project)

Thanks for the response.
--089e013cc030f7eb6a04dbbf38e2--