Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8773 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42318 invoked by uid 1010); 26 Mar 2004 14:38:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42211 invoked from network); 26 Mar 2004 14:38:03 -0000 Received: from unknown (HELO mx.thebrainroom.net) (65.200.24.98) by pb1.pair.com with SMTP; 26 Mar 2004 14:38:03 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id AE5A4148809C; Fri, 26 Mar 2004 06:38:10 -0800 (PST) Received: from tron (zaneeb.thebrainroom.net [82.133.1.138]) by mx.thebrainroom.net (Postfix) with ESMTP id 227C0148809A for ; Fri, 26 Mar 2004 06:38:08 -0800 (PST) Message-ID: <00b001c41340$0082bfe0$8a02a8c0@tron> To: Date: Fri, 26 Mar 2004 14:38:26 -0000 Organization: The Brain Room Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-TBR-Filter: Virus scanned and defanged Subject: serialize() is slow From: wez@thebrainroom.com ("Wez Furlong") I don't normally go in for big arrays in PHP, but I've had the "opportunity" to write a script that grabs a couple of thousand rows from a database, each row having ~120 small fields, and serialize it for consumption elsewhere. I didn't benchmark it, but it takes a good few seconds to serialize. I can write my own serialization function in native php using foreach() and addcslashes etc. and have it run in ~1 second. That probably means that serialize() should be able to run in less time than that. Would one of the performance gurus mind taking a look at serialize? My gut feeling is that there are a lot of reallocs() going on, so it might simply be solved by setting a bigger chunk size (smart_str stuff). --Wez.