From 53d2a48cb1c9d8ca5916dbc0d4320b18683932e2 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 16 Apr 2024 17:48:34 +0200 Subject: [PATCH] Inline the call to `DatabaseObject::__get()` `User::__get()` is called very often on each request, easily stacking up thousands of calls. On a well populated board list this can easily account for up to 1% of runtime. Inlining the check against `$data` cuts down the time spent inside by up to 2/3. --- wcfsetup/install/files/lib/data/user/User.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 0b77456a76..07dc5a769f 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -333,9 +333,7 @@ final class User extends DatabaseObject implements IPopoverObject, IRouteControl */ public function __get($name) { - $value = parent::__get($name); - - return $value ?? $this->getUserOption($name); + return $this->data[$name] ?? $this->getUserOption($name); } /** -- 2.20.1