Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87118 invoked from network); 25 Jul 2016 09:47:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2016 09:47:48 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:38799] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/04-61920-240E5975 for ; Mon, 25 Jul 2016 05:47:47 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 0AD14782F67; Mon, 25 Jul 2016 11:47:43 +0200 (CEST) Received: from w530phpdev (pD9FD2BF6.dip0.t-ipconnect.de [217.253.43.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 4FCB0782F51; Mon, 25 Jul 2016 11:47:41 +0200 (CEST) To: "'Philip Hofstetter'" , "'PHP internals'" References: In-Reply-To: Date: Mon, 25 Jul 2016 11:47:37 +0200 Message-ID: <03dd01d1e659$96040a20$c20c1e60$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFhF6NtoOqXFhWmNZP2vuIluze3ZKEKfpvQ Content-Language: en-us Subject: RE: [PHP-DEV] stat cache / still needed these days? From: anatol.php@belski.net ("Anatol Belski") Hi Philip, > -----Original Message----- > From: Philip Hofstetter [mailto:phofstetter@sensational.ch] > Sent: Monday, July 25, 2016 9:55 AM > To: PHP internals > Subject: [PHP-DEV] stat cache / still needed these days? >=20 > Hi, >=20 > I have just reported #72666 (touch() works differently on plain paths = and file:// > paths with regards to cleaning the stat cache) and I would gladly = provide a PR > with a fix and unit tests. However, before I start working on this = (well - it would > be an easy fix), I would like to question whether the stat cache is a = good idea > and whether it's still (or ever was) needed these days. >=20 > File systems right now are really good at quickly providing the > information: On MacOS I measure only 10% loss in performance when = doing > nothing but calling stat() and clearstatcache() compared to just = calling stat(). > Over NFS on Linux, it's 20%. >=20 > Additionally, I wonder what the stat cache is actually helpful for - = as far as I > understand it, this only helps if you repeatedly call > stat() (or a related function) on the same file within the same = request which > probably isn't very common application behaviour to begin with. >=20 > As such, before I fix touch() to call php_clear_stat_cache(), maybe = it's worth > reconsidering the whole thing and removing it from PHP itself at least = for later > versions, though I guess there I would be in firm RFC territory which = I'd be willing > to write if I had RFC writing credentials. >=20 > What do you think? >=20 Not only single paths fill the cache, but also all the sub-paths. Say = for /a/b/c/d, all the single sub-parts /a/b/c, /a/b, /a will be cached. = So it's not just when some file is accessed, but when siblings with the = joint parent are accessed. This spares a lot of recursive function calls = for the path resolution. Especially in TS, but also in NTS variant. Even = disregarding that, I don't really see any functional gain on removing - = at the end the path will land in some C runtime I/O function as "last = authority". From the experience, path's barely change within the same = request, so the common case profits from the path caching. Regards Anatol