Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1367491608; bh=FieBwzxzIWfi8SnJCEpd82/xAuh8H2Gc6vvgxbO24pE=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=R60UTDY8MLZFPJDoWYvX7gFVbi/B6UuxJiGO9+7zm10n2Rn0OP27HPCZ+QPNI4pXk H1MGOYXMc2wpng0/Zh/6tktki6FV6N+8MRSP/ThMPoIxlhih71moBXr313eoAkrayA uVET9YkqPT+PA47Egn/iYAE17S76ssVEnin3Dwzc= Date: Thu, 02 May 2013 12:46:47 +0200 From: Christian Heimes User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Dan Stromberg Subject: Re: Red Black Tree implementation? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367491610 news.xs4all.nl 15990 [2001:888:2000:d::a6]:40832 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44618 Am 02.05.2013 01:11, schrieb Dan Stromberg: > > What's the best Red Black Tree implementation for Python with an > opensource license? > > I started out looking at > http://newcenturycomputers.net/projects/rbtree.html > because it was > pretty high in Google and had the operators I wanted, but it gets very > slow at about half a million elements. I've been discussing this with a > C programmer who believes that Red Black Trees should perform very > similarly to an AVL tree, but that's not at all what I'm getting with > the newcenturycomputers implementation. 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. Christian