Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10388 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97685 invoked by uid 1010); 10 Jun 2004 15:12:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 97545 invoked from network); 10 Jun 2004 15:12:37 -0000 Received: from unknown (HELO e-matters.de) (217.69.76.213) by pb1.pair.com with SMTP; 10 Jun 2004 15:12:37 -0000 Received: (qmail 2215 invoked by uid 0); 10 Jun 2004 15:11:42 -0000 Received: from p508d78e3.dip.t-dialin.net (HELO php.net) (80.141.120.227) by /var/run/qmail-smtp.pid with SMTP; 10 Jun 2004 15:11:42 -0000 Message-ID: <40C879E8.8010809@php.net> Date: Thu, 10 Jun 2004 17:10:32 +0200 User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net References: <20040609150030.18f59a2c.tony2001@phpclub.net> <20040609155610.0425464f.tony2001@phpclub.net> <20040610115626.7984e4b5.tony2001@phpclub.net> <20040610093552.13990.qmail@pb1.pair.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] stripslashes() improvements From: sesser@php.net (Stefan Esser) Hi, this is not directly releated. I looked into addslashes yesterday and thought that it would be much better to scan the string 2 times. The first time to find out how much extra bytes one needs, and the second time to do the actual replacing. So we do not need to allocate and oversized block and do not need any kind of realloc. This realloc is an absolute performance killer. My patch, which has to be cleaned had the following benchmark results 210000 x addslashes() on different strings (7 alternating strings) PHP5 RC3 - standard 12,x seconds PHP5 RC3 - my patch 7,6 seconds The performance boost was about 4,5 seconds which is more than 33%. Stefan Esser