Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53376 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16743 invoked from network); 20 Jun 2011 10:55:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 10:55:24 -0000 Authentication-Results: pb1.pair.com header.from=robert@xarg.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@xarg.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain xarg.org from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: robert@xarg.org X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:34903] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/46-34681-B172FFD4 for ; Mon, 20 Jun 2011 06:55:24 -0400 Received: by vwl1 with SMTP id 1so1039052vwl.29 for ; Mon, 20 Jun 2011 03:55:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.185.105 with SMTP id fb9mr4209451vdc.286.1308567320907; Mon, 20 Jun 2011 03:55:20 -0700 (PDT) Received: by 10.220.45.196 with HTTP; Mon, 20 Jun 2011 03:55:20 -0700 (PDT) X-Originating-IP: [92.225.216.141] Date: Mon, 20 Jun 2011 12:55:20 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=bcaec547ca7553d07a04a62292de Subject: Optimized smart strings From: robert@xarg.org (Robert Eisele) --bcaec547ca7553d07a04a62292de Content-Type: text/plain; charset=ISO-8859-1 PHP makes use of the smart string library. I've optimized the smart_str_append_long() macro in order to save one division per cycle. At the moment one modulo and one division is used. The optimized version uses one division (which gets optimized away in most situations) and one additional multiplication + subtraction. I've additionally added also a new maco called smart_str_append_const(). This macro is used to append constant strings with a sizeof()-1 instead of strlen() "call". I'd be glad to see this change in 5.4. As I wrote in the earlier post, I'll deliver the patch in addition. PS: yes, this is a really small micro optimization. Robert --bcaec547ca7553d07a04a62292de--