0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

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)
This commit is contained in:
Daniel Lockyer 2024-10-14 10:40:56 +02:00 committed by Daniel Lockyer
parent 90fbbe135f
commit b376585c64

View file

@ -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;
}
/**