Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46711 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78273 invoked from network); 13 Jan 2010 23:37:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2010 23:37:46 -0000 Authentication-Results: pb1.pair.com header.from=tstarling@wikimedia.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=tstarling@wikimedia.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain wikimedia.org from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: tstarling@wikimedia.org X-Host-Fingerprint: 66.111.4.26 out2.smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:41420] helo=out2.smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/59-00773-9495E4B4 for ; Wed, 13 Jan 2010 18:37:46 -0500 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id DC7D7CD9A4 for ; Wed, 13 Jan 2010 18:37:42 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Wed, 13 Jan 2010 18:37:42 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=LVN2AJpqsjc6O87IXAiZNUxkdDQ=; b=YZu2frkUNERy2payIsmEd7100KBy0zOtkbhyml8Mv4bohU1OUDbugcoATo3APO1tUF0bV7gd4tRKSpcoZWJjYnX5GCmGyrmsMSrYFEV1UmWT/Flc3FTn+ZZMKn8TDQvsDyYzvWuDMMIdQQwlHWUYtZfNRwsPZW+VKyo1Esm9ZOQ= X-Sasl-enc: uV1h0ntVsju3Yyom5zmVgZsjhtvlOZOBfG3OXFIFtB8Z 1263425862 Received: from [10.0.0.2] (CPE-124-176-96-118.lns3.ken.bigpond.net.au [124.176.96.118]) by mail.messagingengine.com (Postfix) with ESMTPSA id 2836B3F4A4 for ; Wed, 13 Jan 2010 18:37:41 -0500 (EST) Message-ID: <4B4E5943.3000706@wikimedia.org> Date: Thu, 14 Jan 2010 10:37:39 +1100 User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: internals@lists.php.net References: <4B4DABED.4060202@easyflirt.com> <4B4DBF40.5040801@easyflirt.com> <4B4DCFDA.6090206@dmi.me.uk> <4B4DF01A.1080103@wikimedia.org> <4B4DFBDE.1020906@lerdorf.com> In-Reply-To: <4B4DFBDE.1020906@lerdorf.com> X-Enigmail-Version: 0.95.7 OpenPGP: id=BF976370 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] About optimization From: tstarling@wikimedia.org (Tim Starling) Rasmus Lerdorf wrote: > Tim Starling wrote: > >> Given this, sometimes it's easy to forget that PHP is pathologically >> memory hungry, to the point of making simple tasks difficult or >> impossible to perform in limited environments. It's the worst language >> I've ever encountered in this respect. An array of small strings will >> use on the order of 200 bytes per element. An array of integers will use >> not much less. A simple object (due to being based on the same >> inefficient data structure) may use a kilobyte or two. >> > > A zval is around 64 bytes. So, to use 200 bytes per string element, > each of your strings must be around 136 chars long. > I get 197 on 32-bit and 259 on 64-bit. Try it for yourself if you don't believe me. I've cross-checked memory_get_usage() against "ps -o rss", it's pretty accurate. > For me, working in super high-load environments, this was never an issue > because memory was always way more plentiful than cpu. You can only > slice a cpu in so many slices. Even if you could run 1024 concurrent > Apache/PHP processes, you wouldn't want to unless you could somehow > shove 64 cpus into your machine. For high-performance high-load > environments you want to get each request serviced as fast as possible > and attempting to handle too many concurrent requests works against you > here. > Maybe the tasks you do are usually with small data sets. -- Tim Starling