Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1860 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69834 invoked from network); 21 May 2003 16:36:42 -0000 Received: from unknown (HELO lt1.firehawksystems.com) (64.71.143.247) by pb1.pair.com with SMTP; 21 May 2003 16:36:42 -0000 Received: from wireless-laptop.firehawksystems.com (adsl-63-206-170-177.dsl.sktn01.pacbell.net [63.206.170.177]) (authenticated (0 bits)) by lt1.firehawksystems.com (8.11.6p2/8.11.6) with ESMTP id h4LGabA15778 (using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified NO) for ; Wed, 21 May 2003 09:36:41 -0700 Date: Wed, 21 May 2003 09:36:40 -0700 To: internals@lists.php.net Message-ID: <20030521093640446007.GyazMail.list@firehawksystems.com> Mime-Version: 1.0 (GMessage framework 0.9.9.9) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: GyazMail version 0.9.9.9 Subject: smart_str performance From: list@firehawksystems.com ("Brian J. France") This was a email I sent to Rasmus and another co-worker a while ago and forgot to post the question to the list. I just saw a commit converting zlib to smart_str and figured I would send it now. Comments? Brian ---- I think I found what you were looking for yesterday. implode has change between 4.3 and 4.2. 4.2 does the double pass while 4.3 has changed to use a new smart_str struct with smart_str_appendl function (a struct and function calls around what I was doing in my extension). I decided to run some quick tests and here is what I have found: for ( $i=0; $i < $count; $i++ ) { $arr[] = rand_string_function(); // 12 characters } $start = gettimeofday(); $str = implode( "", $arr ); $end = gettimeofday(); printf( "%8.8d: %8.8f\n", $count, time_diff( $start, $end ) ); give this output: 4.3: 1: 0.00005100 2: 0.00002800 5: 0.00003700 10: 0.00006000 100: 0.00045600 1000: 0.00478600 10000: 0.06507500 100000: 1.71620700 4.2: 1: 0.00004700 2: 0.00002500 5: 0.00002800 10: 0.00004000 100: 0.00022400 1000: 0.00240700 10000: 0.03677200 100000: 0.37068200 While below 10 items I am sure it is hard to tell the difference, but it is slower in all cases. Any clue why one item is slower than two or even five? Brian