From d2df7b24c0494f6da09353518bee9e5d9fba8b38 Mon Sep 17 00:00:00 2001 From: Glen Miner Date: Tue, 17 Dec 2024 12:47:46 -0500 Subject: Optimized WHO command On our server hosting 150K users we noticed that the WHO command was high on the perf capture profile and on closer inspection we noticed that the majority of users do not have the invisible mode set. Since IsModeSet is a small inline function that does an array lookup we were able to reduce server load by calling IsModeSet first to short-circuit the comparatively expensive SharesChannelWith call. --- src/coremods/core_who.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index b7ad9f71a..92c8aee94 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -445,7 +445,7 @@ void CommandWho::WhoUsers(LocalUser* source, const std::vector& par User* user = GetUser(iter); // Only show users in response to a fuzzy WHO if we can see them normally. - bool can_see_normally = user == source || source->SharesChannelWith(user) || !user->IsModeSet(invisiblemode); + bool can_see_normally = user == source || !user->IsModeSet(invisiblemode) || source->SharesChannelWith(user); if (data.fuzzy_match && !can_see_normally && !source_has_users_auspex) continue; -- cgit v1.3.1-10-gc9f91