Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!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.058 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'compiler': 0.07; 'cc:addr :python-list': 0.11; '7:45': 0.16; 'c-level': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'silly': 0.16; 'unlikely': 0.16; 'all.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; '(the': 0.22; 'command': 0.22; 'code,': 0.22; 'programming': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'commands,': 0.24; 'mon,': 0.24; "haven't": 0.24; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'point': 0.28; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'run': 0.32; 'worked': 0.33; 'could': 0.34; 'knows': 0.35; 'something': 0.35; 'no,': 0.35; 'operations': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'possible': 0.36; 'level': 0.37; 'pm,': 0.38; 'that,': 0.38; 'sure': 0.39; 'guy': 0.60; 'ian': 0.60; 'skip:* 10': 0.61; 'simply': 0.61; 'making': 0.63; 'high': 0.63; 'more': 0.64; 'mar': 0.68; 'optimized': 0.68; 'realized': 0.68; 'hour': 0.70; 'therefore': 0.72; 'discover': 0.82; 'verification': 0.83; 'faster.': 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=b26aDeWz9Ptk+/F6ZY9Aax2lxaaSO6V5iooMgVxQkQQ=; b=uqJ5HZ9SaIVnlHu5qo6CZNJaV5UIlpbf+qk5H9RUORnHmgo7wvRYYfescAywBEcfbS ia1LR8O2PkoJjahggB3U6x5DdAc4b89ZZvRKaxmniceb8f63Dge9pcytGefYb4NtYdvW +ygDBKPzuAGje/UykLvaGD/Q/9tKVa1lr7hJQ20wGrEEuta5w3KHRYInQATFQXq433Bv RfTvB/9QBlnPQz+ulhLC5mPQmvw+2O5cGg+3QjxkrGFBcgoj4qfEMuHC8E+RBktT5MOE 5CiSjEjXQ3AAlsRo5AdwFWuP1EEXrpLrXBdohCYo2kw7OL5omxdfQ5/tG0gOnE2pLHQN zPmA== MIME-Version: 1.0 X-Received: by 10.69.25.69 with SMTP id io5mr45285105pbd.22.1394512105196; Mon, 10 Mar 2014 21:28:25 -0700 (PDT) In-Reply-To: References: <87eh2d3x8h.fsf_-_@elektro.pacujo.net> <87eh2ctmht.fsf@elektro.pacujo.net> <87zjkz3eo3.fsf@elektro.pacujo.net> <87a9czrrax.fsf@elektro.pacujo.net> <531d3058$0$29994$c3e8da3$5496439d@news.astraweb.com> <87eh2atw6s.fsf@elektro.pacujo.net> <8761nmrnfk.fsf@elektro.pacujo.net> <531e6643$0$29994$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 11 Mar 2014 15:28:25 +1100 Subject: Re: Balanced trees From: Chris Angelico Cc: Python 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394512113 news.xs4all.nl 2882 [2001:888:2000:d::a6]:33454 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68195 On Tue, Mar 11, 2014 at 2:38 PM, Ian Kelly wrote: > On Mon, Mar 10, 2014 at 7:45 PM, Chris Angelico wrote: >> No no, >> I could make this so much better by using the 80x86 "REP MOVSW" >> command (or commands, depending on your point of view). That would be >> so much better than all those separate operations the silly compiler >> was doing! Roughly an hour of fiddling later, making sure it all still >> worked correctly, I discover that... hmm, it's not actually any >> faster. > > Better to have tried and failed though than to have simply accepted > what the compiler was doing with no verification at all. Maybe. But I've learned now that one guy who used to do assembly language programming on an 8086 is unlikely to discover something that the many authors of a C compiler haven't noticed. Yes, it's possible there'll be something specific to my code, like if I'm doing a strcpy-like operation that isn't *actually* strcpy (the function will be optimized heavily, but a C-level loop might not be recognized), but it's more likely the compiler knows better than I do. That, by the way, was before I realized that *interpreter* writers are more expert than I am, too, and therefore that I can trust a heavily-optimized high level language to run my code faster than I could write equivalent C. ChrisA