Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41852 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81679 invoked from network); 11 Nov 2008 07:14:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2008 07:14:43 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:40772] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/F0-07308-2E039194 for ; Tue, 11 Nov 2008 02:14:42 -0500 Received: from [83.228.56.37] (port=3138 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1KznSQ-0006Yh-Ki for internals@lists.php.net; Tue, 11 Nov 2008 01:14:39 -0600 Message-ID: <39A8D2326F6141C1A24D029E996A2AE1@pc> To: References: <7e270cea0810191211w2cb77075y5e0ad78c2f7306f7@mail.gmail.com> <243C7392-C6A0-4EE8-8AAA-34964E78D453@tekrat.com> <4022974B-4A13-4AB0-A282-973503200406@tekrat.com> <38820B1D-6D5F-4B42-9FEE-0CDF23142A57@tekrat.com> <140FB8F69197441FAB5F45A64FDA946E@pc> <753B18C7-AC2F-4C96-B9CF-9FF5A042B96C@tekrat.com> Date: Tue, 11 Nov 2008 09:14:30 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] An optimization idea From: sv_forums@fmethod.com ("Stan Vassilev | FM") > Since nobody else has chimed in with the obvious (to me, anyways): > > I've worked with some code that uses disgustingly huge (>512Mb) arrays, > largest implementation was a single 2.5 Gb array (before we took the > offending programmer into a room and had a... chat). > > I'd be interested in seeing some metrics on the needed extra CPU ticks > for determining if an array (or array sub-element) is static or dynamic > under the scheme, as well as the extra memory for storing an (many?) > extra value(s). That's not exactly what I had in mind: I don't split whole arrays into static and dynamic (this could be an entirely orthogonal optimization to what I'm saying, similar to what Chrome's V8 engine does currently). We just know a lot more at compile time about member lookups that are defined by a string literal: $obj->foo(), $obj->foo and $arr['foo'] as opposed to fully dynamic accesses which we don't know at parse time: $obj->$bar(), $obj->$bar and $arr[$bar] And we can optimize based on that. I've not spent significant time with the PHP source code yet, to be honest, but if no one is willing to look at it, I could start tinkering with it in my free time and post patches if I arrive at anything. Then we can test how it impacts real world code. Regards, Stan Vassilev