From 6a129ba8ccecf3dd537fc04b4fbf80c5d2bed4f2 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sat, 13 Sep 2025 20:19:01 -0400 Subject: [PATCH] perf: skip quick_check for only one provider The 'quick_check' increases the amount of time it takes to perform a stat operation significantly proportional to the time it takes to do a stat because an fsentry fetch occurs before a transient memoization map is available for an operation. --- src/backend/src/modules/puterfs/MountpointService.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/src/modules/puterfs/MountpointService.js b/src/backend/src/modules/puterfs/MountpointService.js index 94ce41ad4..cfe5f61ae 100644 --- a/src/backend/src/modules/puterfs/MountpointService.js +++ b/src/backend/src/modules/puterfs/MountpointService.js @@ -88,6 +88,14 @@ class MountpointService extends BaseService { } async get_provider (selector) { + // If there is only one provider, we don't need to do any of this, + // and that's a big deal because the current implementation requires + // fetching a filesystem entry before we even have operation-level + // transient memoization instantiated. + if ( Object.keys(this.mountpoints_).length === 1 ) { + return Object.values(this.mountpoints_)[0].provider; + } + try_infer_attributes(selector); if ( selector instanceof RootNodeSelector ) {