From ca83f35782d3a875a7af8ca33c3413dd510b98e3 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 27 Jul 2026 10:12:46 +0200 Subject: [PATCH] perf: Use hash map to check if path was already checked perf: Use hash map to check if path was already checked Faster than using in_array Signed-off-by: Carl Schwan [skip ci] --- lib/private/Files/Cache/Watcher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index 891fe762eb896..8f5f7dcf517c4 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -128,8 +128,8 @@ public function needsUpdate($path, $cachedData) { } } - if ($this->watchPolicy === self::CHECK_ALWAYS || ($this->watchPolicy === self::CHECK_ONCE && !in_array($path, $this->checkedPaths))) { - $this->checkedPaths[] = $path; + if ($this->watchPolicy === self::CHECK_ALWAYS || ($this->watchPolicy === self::CHECK_ONCE && !isset($this->checkedPaths[$path]))) { + $this->checkedPaths[$path] = true; return $cachedData['storage_mtime'] === null || $this->storage->hasUpdated($path, $cachedData['storage_mtime']); } return false;