Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'completeness': 0.07; 'string': 0.09; 'received:155': 0.09; 'character.': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'points:': 0.16; 'received:155.180': 0.16; 'received:159': 0.16; 'received:159.53': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'unfair': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.18; 'slightly': 0.19; '>>>': 0.22; 'bonus': 0.22; 'to:name:python-list@python.org': 0.22; 'bytes': 0.24; 'fixed.': 0.24; 'least': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'characters': 0.30; 'url:mailman': 0.30; '(on': 0.31; '>>>>': 0.31; 'overhead': 0.31; 'figure': 0.32; 'received:169.254': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'skip:s 30': 0.35; 'requirement': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'accuracy': 0.36; 'url:listinfo': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'received:169': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'cost.': 0.60; 'most': 0.60; 'information,': 0.61; 'simple': 0.61; 'purchase': 0.65; 'between': 0.67; '26,': 0.68; 'subject': 0.69; 'fact,': 0.69; 'legal': 0.71; 'jul': 0.74; 'sale': 0.75; 'received:169.254.8': 0.84; '2013': 0.98 X-DKIM: OpenDKIM Filter v2.1.3 sz1.jpmchase.com r6PJV5Rp007838 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1374780665; bh=062AT3DZD05f4Qk2Ysb6MdaMG5gbV+V2R9/FrWiSYdA=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:content-transfer-encoding:MIME-Version; b=hbaiZ7F+IQCfqOP8nCVlF6KXsUmJet9s3ru6iBoH3ZUygrqQLAfdbmYC9DR2ndiWy 4CyE/k22zTO1APCf81NTcQPY4mlpN22JyySSBYW+ThHvdN8NQSaT6++mCCxrqaW+H6 Y48g5p2XMr+EY45tY0ORx7smA9m3fMr1+fQ+3uYk= X-AuditID: a97c8568-b7fe98e00000038f-87-51f17cf726d5 From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: RE Module Performance Thread-Topic: RE Module Performance Thread-Index: AQHOiWo+FkGXydDnY0CgYfHOJVdQ5Jl2B8gA//++wUA= Date: Thu, 25 Jul 2013 19:30:51 +0000 References: <571a6dfe-fd66-42cf-92fc-8b97cbe6e9e4@googlegroups.com> <51DFDE65.5040001@Gmail.com> <4f1067f6-bc99-42ad-9166-37fb228b90e8@googlegroups.com> <0420de60-b9b5-4ac4-ba7b-ca5ac2ca65fe@googlegroups.com> <741eaf38-6655-4763-8962-748408e7c2d8@googlegroups.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Type: text/plain; charset="us-ascii" content-transfer-encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIKsWRmVeSWpSXmKPExsUye4uJoe73mo+BBn8uG1scab3G6sDo8WL+ G7YAxqgGRpvEvLz8ksSSVIWU1OJkWyWXzOLknMTM3NQiBV0Fr4Lc/KL0xDy95PxcJYXMFFsl EyWFgpzE5NTc1LwSW6XEgoLUvBQlOy4FDGADVJaZp5Cal5yfkpmXbqvkGeyva2FhaqlrqGQX kpFZrJCam5iZo5CwkT3j27LlTAWnOCveHv7L1MB4hr2LkZNDQsBE4vD+ZUwQtpjEhXvr2boY uTiEBI4xSpya9ogdwjnEKPFm5g0oZzOjxKyvP5hBWtgEDCWOn30CNkpEwFTi9crdrCC2sICS xJQX/1kh4soS1/f1sEHYVhKbfq4EqufgYBFQlXj8WBMkzCsQIrHs/Fmozf9YJHa9vwXWyykQ KPH3yFoWEJsR6Lzvp9aAncosIC5x68l8qLMFJJbsOc8MYYtKvHz8jxXClpd4MeUlG0S9jsSC 3Z+gbG2JZQtfM0MsFpQ4OfMJC8g9QgJqEvvW24KYEgJ8EtvbqicAPYpk2Swkg2YhGTQLyaAF jCyrGCWLc9MzTPSKy4r0Sov1sgpykzMSi1P18lJLNjECU8rKmtaMHYxLltseYhTgYFTi4VV0 +hgoxJpYVlyZCwxoDmYlEd5DWScDhXhTEiurUovy44tKc1KLDzFWAcNsIrOUaHI+MN3llcQb GptZGJiaGhpYGBqZUEVYSZzXae2zQCGBdGBSzU5NLUgtglnOxMEp1cCofP5aNe/5DTGnFt3s TjTW5ahpSeV9dOD2/OOdOdPm7ajrMtDlqD3vZPWs7cRlr2V65rpPTonkHFEx7QmZalD1fM8B EbXDb0/pXVJ6N2NB45xa43hX1YN35nQKzeYQYigS37Zt0m2eKQ0p9dfe91RM3O045/ePg3/6 Ul+9WSMwyW0n0y3W+beclViKMxINtZiLihMB6JAsEoQDAAA= 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: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374781129 news.xs4all.nl 15994 [2001:888:2000:d::a6]:58549 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51258 Chris Angelico wrote: > On Fri, Jul 26, 2013 at 5:07 AM, wrote: > > Let start with a simple string \textemdash or \texttendash > > > >>>> sys.getsizeof('-') > > 40 > >>>> sys.getsizeof('a') > > 26 > > Most of the cost is in those two apostrophes, look: > > >>> sys.getsizeof('a') > 26 > >>> sys.getsizeof(a) > 8 > > Okay, that's slightly unfair (bonus points: figure out what I did to > make this work; there are at least two right answers) but still, look > at what an empty string costs: I like bonus points. :) >>> a =3D None >>> sys.getsizeof(a) 8 Not sure what the other right answer is...booleans take 12 bytes (on 2.6) > > >>> sys.getsizeof('') > 25 > > Or look at the difference between one of these characters and two: > > >>> sys.getsizeof('aa')-sys.getsizeof('a') > 1 > >>> sys.getsizeof('--')-sys.getsizeof('-') > 2 > > That's what the characters really cost. The overhead is fixed. It is, > in fact, almost completely insignificant. The storage requirement for > a non-ASCII, BMP-only string converges to two bytes per character. > > ChrisA > -- > http://mail.python.org/mailman/listinfo/python-list Ramit This email is confidential and subject to important disclaimers and conditio= ns including on offers for the purchase or sale of securities, accuracy and= completeness of information, viruses, confidentiality, legal privilege, and= legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclo= sures/email.