From 5f6a6e659695136d0c8bef070b2467e83347b58d Mon Sep 17 00:00:00 2001 From: francesco Date: Tue, 11 Feb 2025 17:13:15 +0100 Subject: [PATCH] perf(pg): avoid useless spread (#3379) * perf(pg): avoid useless spread * fix: missing initialization --- packages/pg/lib/result.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/pg/lib/result.js b/packages/pg/lib/result.js index f510d246..25aff490 100644 --- a/packages/pg/lib/result.js +++ b/packages/pg/lib/result.js @@ -88,11 +88,11 @@ class Result { this._parsers = new Array(fieldDescriptions.length) } - var row = {} + this._prebuiltEmptyResultObject = {} for (var i = 0; i < fieldDescriptions.length; i++) { var desc = fieldDescriptions[i] - row[desc.name] = null + this._prebuiltEmptyResultObject[desc.name] = null if (this._types) { this._parsers[i] = this._types.getTypeParser(desc.dataTypeID, desc.format || 'text') @@ -100,7 +100,6 @@ class Result { this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || 'text') } } - this._prebuiltEmptyResultObject = { ...row } } }