Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(even': 0.05; 'puts': 0.07; 'if,': 0.09; 'key.': 0.09; 'cc:addr:python-list': 0.11; '24,': 0.16; 'boundaries,': 0.16; 'exponential': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'closer': 0.31; 'sep': 0.31; 'yourself.': 0.31; 'probably': 0.32; 'running': 0.33; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'subject:?': 0.36; 'being': 0.38; 'problems': 0.38; 'subject:" ': 0.39; 'even': 0.60; "you're": 0.61; "you'll": 0.62; 'limit': 0.70; '2.000': 0.84; 'to:none': 0.92 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:cc :content-type; bh=3S1Bbvj2g8NhVDN3+3jBl5U6gapev8rxU7GGbcmrU+8=; b=vVopsuaZYhChp3VhJFJRwlSPA/5XWTGN084WGHc/EoBCxjFhIRmo3koo9FeV2w234R CL7M6P5WO/oetpXvJ8ezfOi4wlgtz8qL990h3PwWX1beaudezjob87F+9SQc1cuOvGHX ty9PNkAJxys6wR5eIk/uLDeWvXcgaTv4EttnYW2Zz7XsNNZwwuZF2qjovK2kNOrPQ821 ZFJ/xFJN0Aupp1jQcwYYLjvqJfnnrqJ4fQYUpIz3JJR/JhIKtTzy9Qdok714pjeFbY5C rgRMOW0WriX/e19WWpmfC2YbcAQpTlBRlauR9YCfYzBcZesNl5pF8OZ3aiHTh2vyNjMo O6bg== MIME-Version: 1.0 X-Received: by 10.51.17.2 with SMTP id ga2mr5113643igd.2.1411490464513; Tue, 23 Sep 2014 09:41:04 -0700 (PDT) In-Reply-To: <20140923093244.066bb10b@rg.highlandtechnology.com> References: <0d28ee82-2240-4f10-9db9-e966c0e62a13@googlegroups.com> <20140923093244.066bb10b@rg.highlandtechnology.com> Date: Wed, 24 Sep 2014 02:41:04 +1000 Subject: Re: "Fuzzy" Counter? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411490468 news.xs4all.nl 2926 [2001:888:2000:d::a6]:35678 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78226 On Wed, Sep 24, 2014 at 2:32 AM, Rob Gaddi wrote: > You'll probably have to write that yourself. While you're at it, think > long and hard about that definition of fuzziness. If you can make it > closer to the concept of histogram "bins" you'll get much better > performance. If, for instance, you can live with 1.anything being one > bin, and 2.anything being the next (even though this puts 1.999 and > 2.000 into separate bins) then you can just floor() the number and use > the result as the key. Or even check three bins based on that - the floor(), floor()+1, and floor()-1 bins. That way, you're not running into problems at any boundaries, and you still limit the exponential growth of the comparisons. But it's still fundamentally problematic. ChrisA