From b376585c640bf999bb5494b73f83b84292b11491 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 14 Oct 2024 10:40:56 +0200 Subject: [PATCH] Optimized Resources constructor - this code has shown to be chronically slow, due to the `Object.assign` - we don't really need this, as we can just use a normal assign in this case - this cuts 15% CPU from boot time for sites with a lot of resources (posts) --- ghost/core/core/server/services/url/Resource.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ghost/core/core/server/services/url/Resource.js b/ghost/core/core/server/services/url/Resource.js index 26a0435f7b..ebcbfaf681 100644 --- a/ghost/core/core/server/services/url/Resource.js +++ b/ghost/core/core/server/services/url/Resource.js @@ -13,13 +13,12 @@ class Resource extends EventEmitter { constructor(type, obj) { super(); - this.data = {}; this.config = { type: type, reserved: false }; - Object.assign(this.data, obj); + this.data = obj; } /**