Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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 X-Spam-Status: OK 0.070 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'startup': 0.05; 'subject:Python': 0.06; 'binary': 0.07; 'cc:addr:python-list': 0.11; 'guess.': 0.16; 'search:': 0.16; 'subject:user': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'constant': 0.31; 'convince': 0.31; 'probably': 0.32; 'running': 0.33; "i'd": 0.34; 'agree': 0.35; 'more,': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'subject:New': 0.37; 'two': 0.37; 'server': 0.38; 'nov': 0.38; 'expect': 0.39; '12,': 0.39; 'space': 0.40; 'subject: / ': 0.60; 'free': 0.61; 'you.': 0.62; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'worth': 0.66; 'obvious': 0.74; 'optimisation': 0.84; 'premature': 0.84; 'factors': 0.97; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Et6F830eWLx4DFFk21TBTATGm/YqkNDF8cadQUwB7Ls=; b=BkuoARxm4BiWTQOhKZiKL1wZOVsjCVGq1CjFu1l5N0Qca12Miq59ICmx3lOlP+5lnF lyU6ivXleIbllum9NJ/GvokuGGBnTHDnWBdeifhpjlfhsqJzyXCyRtH5u/ah4ZLix8Nc TVJuWHHb1uYxFJ/rfCyKhF9cNA8IhAHNfiwzJf27HOX8m2EjqLajjyYf7lXi+wf3jwQo aCpFW+wFqjnpXip/plaXjqQLXznpKoqcGYn9lUC8ziAVLk/ZWZBsFOUV52asyWUMTO7m w9MQfpIBtiY/j5td+lAK+VPAgZVig3MOHgtNPAm99VzWU2A60IVGlU4VxwN8iQjd+OCd FVUA== X-Received: by 10.112.143.3 with SMTP id sa3mr24265385lbb.12.1384221245023; Mon, 11 Nov 2013 17:54:05 -0800 (PST) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: References: <-JadnUirYuhUruPPnZ2dnUVZ8rSdnZ2d@bt.com> <1c4c0901-f80a-42f3-9df5-7e7431353079@googlegroups.com> From: Joshua Landau Date: Tue, 12 Nov 2013 01:53:24 +0000 X-Google-Sender-Auth: g3GabaKz1DFGSK1G1xyWhz-N0yE Subject: Re: New user's initial thoughts / criticisms of Python To: Chris Angelico Content-Type: text/plain; charset=UTF-8 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384221253 news.xs4all.nl 15946 [2001:888:2000:d::a6]:52131 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59134 On 11 November 2013 22:21, Chris Angelico wrote: > On Tue, Nov 12, 2013 at 7:50 AM, Joshua Landau wrote: >> The obvious way to me is a binary search: > > Which makes an O(log n) search where I have an O(1) lookup. The > startup cost of denormalization doesn't scale, so when the server > keeps running for two years or more, it's definitely worth processing > it that way. log 4 is tiny so I'd expect constant factors to be far more significant here. Then you add on the better asymptotic behaviours for large n, space wise, and the simplicity of implementation. This just seems like a premature optimisation to me, I guess. I agree that your way is faster; I just don't see a single case in which I'd care. I do see several circumstances (large or floating numbers) in which I'd probably prefer my way. Feel free to disagree, I'm not really trying to convince you.