Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1835 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21133 invoked from network); 21 May 2003 02:29:32 -0000 Received: from unknown (HELO carmine.bestweb.net) (209.94.102.73) by pb1.pair.com with SMTP; 21 May 2003 02:29:32 -0000 Received: from [192.168.1.101] (ip216-179-71-153.cust.bestweb.net [216.179.71.153]) by carmine.bestweb.net (Postfix) with ESMTP id 513C12323B for ; Tue, 20 May 2003 21:29:33 -0500 (EST) To: internals@lists.php.net Content-Type: multipart/mixed; boundary="=-m8/iRaYSFm8je+yK3bsD" Organization: Message-ID: <1053479023.27575.20.camel@hasele> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 20 May 2003 21:03:43 -0400 Subject: small performance improvement to number stuff From: sterling@bumblebury.com (Sterling Hughes) --=-m8/iRaYSFm8je+yK3bsD Content-Type: text/plain Content-Transfer-Encoding: 7bit Hey, Attached is small patch which optimizes the zendi_convert_scalar_to_number() function, by only calling convert_scalar_to_number when it is required. This is a nice speedup of numerical operations, as its not very often you do numerical operations on strings (at least not as often as you do them on numbers :) -Sterling -- "Science is like sex: sometimes something useful comes out, but that is not the reason we are doing it." - Richard Feynman --=-m8/iRaYSFm8je+yK3bsD Content-Disposition: attachment; filename=faster_numbers.diff Content-Type: text/x-patch; name=faster_numbers.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Index: zend_operators.c =================================================================== RCS file: /repository/ZendEngine2/zend_operators.c,v retrieving revision 1.149 diff -u -r1.149 zend_operators.c --- zend_operators.c 20 May 2003 22:31:15 -0000 1.149 +++ zend_operators.c 21 May 2003 02:27:35 -0000 @@ -143,7 +143,7 @@ } #define zendi_convert_scalar_to_number(op, holder, result) \ - if (op==result) { \ + if (op==result && op->type != IS_LONG && op->type != IS_DOUBLE) { \ convert_scalar_to_number(op TSRMLS_CC); \ } else { \ switch ((op)->type) { \ --=-m8/iRaYSFm8je+yK3bsD--