Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Question about math.pi is mutable Date: Tue, 10 Nov 2015 10:21:05 +1100 Lines: 45 Message-ID: References: <563eba85$0$1611$c3e8da3$5496439d@news.astraweb.com> <87ziyowy83.fsf@elektro.pacujo.net> <8537wghwjb.fsf@benfinney.id.au> <85y4e8ggrj.fsf@benfinney.id.au> <85twowgfm6.fsf@benfinney.id.au> <564081e7$0$1592$c3e8da3$5496439d@news.astraweb.com> <85fv0fgdnf.fsf@benfinney.id.au> <201511092007.tA9K7vbW000701@fido.openend.se> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de qw0ZKXGBRwS1XFlZHL4PkQJOe349kO2g5hH2XArISiFg== Cancel-Lock: sha1:GGQW3Peh80z5FMz9HvvhWAEAjyc= 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; 'subject:Question': 0.05; 'remaining': 0.07; 'considered.': 0.09; 'creighton': 0.09; 'function),': 0.09; 'issue:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'units.': 0.09; '*any*': 0.16; '*only*': 0.16; 'distinction': 0.16; 'negates': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'segment': 0.16; 'trivially': 0.16; 'case.': 0.18; 'laura': 0.18; '2015': 0.20; 'proposed': 0.20; "aren't": 0.22; 'arguments': 0.22; 'explicit': 0.22; 'large,': 0.22; 'code,': 0.23; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; '(e.g.': 0.27; 'small,': 0.27; "i'm": 0.30; 'anywhere': 0.30; "we're": 0.30; 'code': 0.30; 'class': 0.33; 'usually': 0.33; 'instead,': 0.33; 'tue,': 0.34; 'that,': 0.34; 'could': 0.35; 'nov': 0.35; 'skip:> 10': 0.35; '(i.e.': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'things': 0.38; 'skip:p 20': 0.38; 'why': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'space': 0.40; 'your': 0.60; 'entire': 0.61; 'making': 0.62; 'safe': 0.63; 'between': 0.65; 'benefit': 0.66; 'talking': 0.67; 'worth': 0.67; '_o__)': 0.84; 'complex,': 0.84; 'isolated': 0.84; 'moot': 0.84; 'optimisation': 0.84; 'received:125': 0.84; 'upset': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98561 Laura Creighton writes: > In a message of Tue, 10 Nov 2015 06:45:40 +1100, Ben Finney writes: > >So the remaining space of code that is safe for the proposed > >optimisation is trivially small. Why bother with such optimisations, if > >the only code that can benefit is *already* small and simple? > > You have things backwards. > The reason that you want to optimise this is that it is small, simple, > and slow_slow_slow_slow_slow. > > It is the things that are complicated and large that usually aren't > worth optimising. You don't call them often enough for it to be worth > it to optimise them. I appreciate you making the the distinction explicit between a small and simple *code unit* (e.g. an small, simple, often-called function), versus a large and complex *code unit* (e.g. a large, complex, infrequently-called class definition). I'm pointing out an orthogonal issue: The only code to which the proposed optimisation could apply is *module-level* (infrequently called) code, which *has no complications* (i.e. not a code unit). The simplicitly of the small section of code is not the issue; the dynamism of the entire program is what negates the applicability of the optimisation. If the simple, predictable-by-the-compiler segment of code were actually isolated in a simple unit, then yes, such optimisations might be considered. But, as already discussed, the optimisation is not intended to apply to such code units. So that is moot in this case. Instead, we're talking about optimisations proposed *only* for module-level code (i.e. not isolated); and what negates their applicability is *any* dynamism (i.e. not simple), anywhere in the program (i.e. not a code unit). The space of applicability for the proposed optimisation shrinks to irrelevance, AFAICT. -- \ “If the arguments in favor of atheism upset you, explain why | `\ they’re wrong. If you can’t do that, that’s your problem.” | _o__) —Amanda Marcotte, 2015-02-13 | Ben Finney