Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82103 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59577 invoked from network); 7 Feb 2015 23:13:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2015 23:13:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=serovov@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=serovov@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.175 as permitted sender) X-PHP-List-Original-Sender: serovov@gmail.com X-Host-Fingerprint: 209.85.213.175 mail-ig0-f175.google.com Received: from [209.85.213.175] ([209.85.213.175:53108] helo=mail-ig0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/21-50836-81C96D45 for ; Sat, 07 Feb 2015 18:13:28 -0500 Received: by mail-ig0-f175.google.com with SMTP id hn18so9826525igb.2 for ; Sat, 07 Feb 2015 15:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=GFuaHaUZWKBbZlRHnaJKPUW8Mmlte7VSNvD5PLVNghI=; b=YyZhvIbylcy34ni7C1aacWIwatBAYV8EK6WRROFPJodxYCGOpMDkhU0xxnZCYY5Blt vJP54mzyoRd/HGYUYx5eNFk9PAGoKles4M70m5VVXokYcWJ/o5fGsSqDH/t7bOEG5/Tq aN0pIgG/SIH4MfT/Qman2Q6n2ZipKfbJc5Awjyt8ctYW1UP1DjJbTnpHLQi7rG+UR55V g8ZE5cx4ujYXGttewef/tWdb2RKh7Z3q2E49phQS1xbRIYr2FaadQYR6ciYL6h782f8W IjXY3TvpCPqzgpmVapO/wFgHEyhkK94LSRM9lt5DQehBCzP+h+erbKDypPvGNJuzXhF3 qkqg== X-Received: by 10.107.14.141 with SMTP id 135mr18466681ioo.4.1423350805188; Sat, 07 Feb 2015 15:13:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.111.232 with HTTP; Sat, 7 Feb 2015 15:13:05 -0800 (PST) Date: Sat, 7 Feb 2015 18:13:05 -0500 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a113fefc22259cf050e87af9c Subject: Idea of optimizing php !empty(...) expression. From: serovov@gmail.com (Oleg Serov) --001a113fefc22259cf050e87af9c Content-Type: text/plain; charset=UTF-8 I use !empty() very often and decided to make a benchmark test. Here is the code and results: http://pastebin.com/fMhhdQiW if (!empty(...)) working on 23% slower than if (empty()) expression. So if create new operator not_empty() it will improve performance. The first question is: What do you think about optimizing !empty(...), do we need it ? And I see two way to make this happen. 1. Create new language entity "not_empty". 2. Improve parser and help to handle "!empty" calls different way. It is obviously that option 2 is better. Is it real to optimize parser that way? Thanks! -- Best Regards, Oleg --001a113fefc22259cf050e87af9c--