Skip to content

Commit

Permalink
Optimize memory usage in item data processing (#317)
Browse files Browse the repository at this point in the history
The commit replaces two 'const' declarations with 'let' in 'item-data-processing.ts' for rawData and rawDataArray. After these variables are used, they are set to null, freeing up memory space. The change is aimed at optimizing memory usage and improving performance.
  • Loading branch information
ludeknovy authored Apr 12, 2024
1 parent 49f30e8 commit 83fd971
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/server/controllers/item/shared/item-data-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ export const itemDataProcessing = async ({ projectName, scenarioName, itemId })
const responseFailures = await db.manyOrNone(responseMessageFailures(itemId))
const scenarioSettings = await db.one(getScenarioSettings(projectName, scenarioName))

const rawData = await db.manyOrNone(findRawData(itemId))
const rawDataArray = rawData?.map(row => [moment(row.timestamp).valueOf(), row.elapsed])
let rawData = await db.manyOrNone(findRawData(itemId))
let rawDataArray = rawData?.map(row => [moment(row.timestamp).valueOf(), row.elapsed])
const rawDataDownSampled = downsampleData(rawDataArray, MAX_SCATTER_CHART_POINTS)
const groupedErrors = await db.manyOrNone(findGroupedErrors(itemId))
const top5ErrorsByLabel = await db.manyOrNone(findTop5ErrorsByLabel(itemId))
rawData = null
rawDataArray = null

if (aggOverview.number_of_sut_hostnames > 1) {
sutMetrics = await db.many(sutOverviewQuery(itemId))
Expand All @@ -76,7 +78,6 @@ export const itemDataProcessing = async ({ projectName, scenarioName, itemId })
}))
}


const {
overview,
overview: { duration },
Expand Down

0 comments on commit 83fd971

Please sign in to comment.