Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102007 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20170 invoked from network); 29 Mar 2018 09:51:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2018 09:51:29 -0000 Authentication-Results: pb1.pair.com header.from=ben.coutu@zeyos.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ben.coutu@zeyos.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zeyos.com designates 88.99.153.70 as permitted sender) X-PHP-List-Original-Sender: ben.coutu@zeyos.com X-Host-Fingerprint: 88.99.153.70 mx.zeyos.com Received: from [88.99.153.70] ([88.99.153.70:51842] helo=mx.zeyos.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/71-06325-B17BCBA5 for ; Thu, 29 Mar 2018 04:51:24 -0500 Received: from mx.zeyos.com (localhost [127.0.0.1]) by mx.zeyos.com (Postfix) with ESMTP id C8C0D5FB03 for ; Thu, 29 Mar 2018 11:51:20 +0200 (CEST) Authentication-Results: mx.zeyos.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=zeyos.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zeyos.com; h= content-transfer-encoding:content-type:content-type:mime-version :to:from:from:subject:subject:date:date; s=dkim; t=1522317080; x=1523181081; bh=Ethc6QMlyzOQ9/spWJc0eKL4YJ93TUyKcAPsImq27z8=; b= MvGqXOCun7yN5YSaT4RUKGWDpRhwpEAXwMwzICfemgeyUt/CS2hHDLRyeo9cSPtM z4xLCCy4Ng4gpyVfeefAE9PbUILHQ7vq5iPfHBWqisHDA1/gsb7MSOfV21d9D8B7 dE86WMtHP/TRwbG85Hn0fWjAJ3tZdDhrj6FSxdJ1dkI= X-Virus-Scanned: Debian amavisd-new at mx.zeyos.com Received: from mx.zeyos.com ([127.0.0.1]) by mx.zeyos.com (mx.zeyos.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id l43XVdYAu_yS for ; Thu, 29 Mar 2018 11:51:20 +0200 (CEST) Received: from [81.171.8.203] (unknown [81.171.8.203]) by mx.zeyos.com (Postfix) with ESMTPSA id 786FB5FB01; Thu, 29 Mar 2018 11:51:20 +0200 (CEST) Date: Thu, 29 Mar 2018 11:51:20 +0200 To: PHP Internals Cc: Nikita Popov , Fleshgrinder MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20180329095120.C8C0D5FB03@mx.zeyos.com> Subject: Unnecessary overhead in getdate() From: ben.coutu@zeyos.com (Benjamin Coutu) Hello,=0A=0AJust like `[i]date()`, `getdate()` without the `$timestamp` arg= ument uses the current timestamp.=0A=0AThe code for `[i]date()` (https://gi= thub.com/php/php-src/blob/master/ext/date/php_date.c#L1276) only makes a sy= stem call to `time(NULL)` when the `$timestamp` argument is missing. In con= trast `getdate()` (https://github.com/php/php-src/blob/master/ext/date/php_= date.c#L1828) always performs a system call to `time(NULL)` even if `$times= tamp` is supplied by the user.=0A=0AThe code for `getdate()` should mimic w= hat is done for `date()` to avoid unnecessary system call overhead, hence o= nly call `time(NULL)` when `!ZEND_NUM_ARGS()`.=0A=0ACan someone please make= the appropriate change? Please apologize, but I simply review code and do = not have a proper C development setup that allows me to supply patches or c= reate pull requests.=0A=0AThanks,=0A=0ABen=0A=0A-- =0A=0ABenjamin Coutu=0A= =0Ahttp://www.zeyos.com