Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'tree': 0.05; 'binary': 0.07; 'badly': 0.09; 'dan': 0.09; 'enormous': 0.09; 'fixed,': 0.09; 'keys,': 0.09; 'thrown': 0.09; 'trees': 0.09; 'cc:addr:python-list': 0.11; 'random': 0.14; '100000000': 0.16; 'cc:name:python list': 0.16; 'pairs': 0.16; 'reasonably': 0.16; 'sequential': 0.16; 'throw': 0.16; 'worse.': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'second': 0.26; 'values': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'keys': 0.31; 'anyone': 0.31; 'run': 0.32; 'quite': 0.32; 'sense': 0.34; "i'd": 0.34; 'operations': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'list.': 0.37; 'pm,': 0.38; 'rather': 0.38; 'bad': 0.39; 'how': 0.40; 'read': 0.60; 'more': 0.64; 'linked': 0.65; 'series': 0.66; 'mar': 0.68; '"too': 0.84; '(probably': 0.84; 'studying': 0.84; 'imagine': 0.93 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 :cc:content-type; bh=Mkf4KqvNqAh0jlDKYsjaI/japDZ/E/+goMZTcTVkGYQ=; b=rK8mfawpfga7S/6AaULsQql6BUkCpx4fvr83rcb8WnWca4NCO8NZUKAPsX1VuKY0vo A1L5GoxAG2j1m0nqvY4snQjCpUEr8BP2qfDex/vZwpqSV8i5oV3DTvYVK6E0qW98bi0+ UHpnExvnhKytvqnqYSFGD0AQmZLgJMIlzhfHBP/hi7Nd0ZJKCnn0FjOAZheLZBykh5Py gsx7NILrgb6aI8/CY69nxU0UoA5VEZrTRip/7Kj3UghnmBEAATMtCe57gi2o/yRqn4Vf EDTF1O2TmXgFwGq8Z8biNcgQpg1GLVy8nampYUDHNf0lOFQy0SLMvu8eyBJz3iMgFh6T WRfQ== MIME-Version: 1.0 X-Received: by 10.236.104.200 with SMTP id i48mr1475990yhg.61.1395181288521; Tue, 18 Mar 2014 15:21:28 -0700 (PDT) In-Reply-To: <87wqfrp3jk.fsf@elektro.pacujo.net> References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> <87mwgoqy4k.fsf@elektro.pacujo.net> <8738ifqlaw.fsf@elektro.pacujo.net> <87wqfrp3jk.fsf@elektro.pacujo.net> Date: Tue, 18 Mar 2014 15:21:28 -0700 Subject: Re: Balanced trees From: Dan Stromberg To: Marko Rauhamaa Content-Type: text/plain; charset=ISO-8859-1 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395181297 news.xs4all.nl 2943 [2001:888:2000:d::a6]:48589 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68523 On Tue, Mar 18, 2014 at 3:03 PM, Marko Rauhamaa wrote: > Dan Stromberg : > For a proper comparison, I'd like a fixed, identical dataset and set of > operations run against each data structure. > > How about this test program: I used to do essentially this, but it was time-prohibitive and produced harder-to-read graphs - harder to read because the enormous values of the bad trees were dwarfing the values of the good trees. Imagine doing 100000000 operation tests for the unbalanced binary tree. For a series of random keys, it would do quite well (probably second only to dict), but for a series of sequential keys it would take longer than anyone would reasonably want to wait because it's basically a storage-inefficient linked list. Rather than throw out unbalanced binary tree altogether, it makes more sense to run it until it gets "too slow". The workload+interpreter pairs are all tested the same way, it's just that the ones that are doing badly are thrown out before they're able to get a lot worse. Studying the graphs will likely help develop an intuition for what's happening.