From f5b02ebe7bf65be295cc44fb95c426ac3c9101f9 Mon Sep 17 00:00:00 2001 From: Stefan Blaginov Date: Thu, 1 Feb 2024 15:09:00 +0000 Subject: [PATCH] feat(models): heap size performance optimization Signed-off-by: Stefan Blaginov Signed-off-by: Stefan Blaginov --- lib/common/benchmarkModelGenerator.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/common/benchmarkModelGenerator.js b/lib/common/benchmarkModelGenerator.js index 51b693f..a487c8e 100644 --- a/lib/common/benchmarkModelGenerator.js +++ b/lib/common/benchmarkModelGenerator.js @@ -153,7 +153,7 @@ class BenchmarkModelGenerator { propertiesSizeBudget = propertiesSizeBudget - this.jsonSize(generatedProperty); if (propertiesSizeBudget >= 0) { propertyI++; - properties = [ ...properties, generatedProperty ]; + properties.push(generatedProperty); } else { oversized = true; } @@ -234,7 +234,7 @@ class BenchmarkModelGenerator { declarationsSizeBudget = declarationsSizeBudget - this.jsonSize(generatedDeclaration); if (declarationsSizeBudget >= 0) { declarationI++; - declarations = [...declarations, generatedDeclaration]; + declarations.push(generatedDeclaration); } else { oversized = true; } @@ -262,13 +262,13 @@ class BenchmarkModelGenerator { declarationsSizeBudget - this.jsonSize(declarations) ) / (nDeclarations - declarationI); - const declaration = this.generateDeclarationToSize({ + const generatedDeclaration = this.generateDeclarationToSize({ modelI, declarationI, declarationSizeBudget: remainingDeclarationSizeBudget, }); declarationI++; - declarations = [ ...declarations, declaration ]; + declarations.push(generatedDeclaration); } return declarations;