Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '16,': 0.03; 'objects,': 0.09; 'pointers': 0.09; 'cc:addr:python-list': 0.11; 'posted': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'python-dev,': 0.16; 'stats': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'work,': 0.20; 'memory': 0.22; 'select': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; '15,': 0.26; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'types.': 0.31; 'probably': 0.32; 'fri,': 0.33; 'actual': 0.34; 'done.': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'possible': 0.36; 'being': 0.38; 'itself': 0.39; 'how': 0.40; 'read': 0.60; 'ian': 0.60; 'removing': 0.60; 'filling': 0.78; '1:00': 0.84; '2015': 0.84; 'optimized,': 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=xEJpXZGg3eRboYrewbKXo+1eVmEABLSjh4s/M0qBW7c=; b=kApPpFHw7pIIOHLR7rfjUFnv1BByUEM8ph3Ryg7r0oDMYZ2QtZLWOrUfl63pQ6PPie KUn+8rSVbbViJRJl7ZcRdWTVi0VNiOWEne8Hqh+cyLPPUnkDrXIEncVimN2UBLlJNKK3 KNy98SmYYM5jUkQOIkrlh0Q/pQs8x3CUozXg+TpZSKGur9lXW6yQ7Js/V0f+6f7Itfma MmQdWwDdqvdaHcBnl6AoCXagEcZuGXkM+AhwJ7qNtNd7OBYg1Pln3nAH/4fuS38+kMgl +Bnh8ADkmZKbkMb4CqYk40H+m+gQXm4hK/VLW3DyHXOwVVsNNge3Zu4pvEKRvmCSYtr3 qPng== MIME-Version: 1.0 X-Received: by 10.50.43.196 with SMTP id y4mr25575455igl.14.1431702418911; Fri, 15 May 2015 08:06:58 -0700 (PDT) In-Reply-To: References: <7JN4x.37133$Q41.15375@fx25.am4> <6w35x.645690$I97.19867@fx31.am4> <874mnfunpn.fsf@elektro.pacujo.net> <87bnhmgqrx.fsf@elektro.pacujo.net> <87382yglmy.fsf@elektro.pacujo.net> <5555e9de$0$13007$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 16 May 2015 01:06:58 +1000 Subject: Re: Building CPython From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 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: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431702433 news.xs4all.nl 2863 [2001:888:2000:d::a6]:52337 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90681 On Sat, May 16, 2015 at 1:00 AM, Ian Kelly wrote: > On Fri, May 15, 2015 at 6:43 AM, Steven D'Aprano > wrote: >> How much time would it save? Probably very little. After all, unless the >> method call itself did bugger-all work, the time to create the method >> object is probably insignificant. But it's a possible optimization. > > An interesting alternative (if it's not already being done) might be > to maintain a limited free-list of method objects, removing the need > to allocate memory for one before filling it in with data. It is already done. Some stats were posted recently to python-dev, and (if I read them correctly) method objects are among the free-list types. So the actual memory (de)allocations are optimized, and all that's left is setting a couple of pointers to select an object and a function. ChrisA