From f62ac5d81d887a45ef4834c4d5e40433d116d787 Mon Sep 17 00:00:00 2001 From: Andrew January Date: Tue, 17 Aug 2021 09:05:19 +0100 Subject: [PATCH] Kernel/SysFS: Prepend to the custody cache instead of append Usage patterns mean we are more likely to need a Custody we just cached. Because lookup walks the list from the beginning, prepending new items instead of appending means they will be found quicker. This reduces the number of items in the cache we need to walk by 50% for boot and application startups. --- Kernel/FileSystem/Custody.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/FileSystem/Custody.cpp b/Kernel/FileSystem/Custody.cpp index d211c37684..2b92f15cb8 100644 --- a/Kernel/FileSystem/Custody.cpp +++ b/Kernel/FileSystem/Custody.cpp @@ -40,7 +40,7 @@ KResultOr> Custody::try_create(Custody* parent, StringVie if (!custody) return ENOMEM; - all_custodies.append(*custody); + all_custodies.prepend(*custody); return custody.release_nonnull(); }); }