Skip to content

Performance tuning for number formatting #2010

Performance tuning for number formatting

Performance tuning for number formatting #2010

Triggered via pull request October 18, 2024 13:18
Status Failure
Total duration 55s
Artifacts

CI.yaml

on: pull_request
Matrix: Python
Fit to window
Zoom out
Zoom in

Annotations

2 errors
qa.spec.ts > QA > js/octorelay.js build remains: ui/qa.spec.ts#L12
Error: Snapshot `QA > js/octorelay.js build remains 1` mismatched - Expected + Received @@ -5,10 +5,14 @@ var closeBtnId = "pop-closer"; var closeIconHTML = '<span class="fa fa-close fa-sm"></span>'; var closeBtnHTML = `<button id="${closeBtnId}" type="button" class="close">${closeIconHTML}</button>`; // helpers/countdown.ts + var createNumberFormat = _.memoize( + (...[locale, options]) => new Intl.NumberFormat(locale, options), + (...[locale, options]) => [locale, options == null ? void 0 : options.unit, options == null ? void 0 : options.maximumFractionDigits].join("|") + ); var formatDeadline = (time, locales = [LOCALE, void 0]) => { let unit = "second"; let timeLeft = (time - Date.now()) / 1e3; if (timeLeft >= 60) { timeLeft /= 60; @@ -20,11 +24,11 @@ } const isLastMinute = unit === "minute" && timeLeft < 2; const nonNegTimeLeft = Math.max(0, timeLeft); for (const locale of locales) { try { - const formattedTimeLeft = new Intl.NumberFormat(locale, { + const formattedTimeLeft = createNumberFormat(locale, { style: "unit", unitDisplay: "long", minimumFractionDigits: isLastMinute ? 1 : 0, maximumFractionDigits: isLastMinute ? 1 : 0, unit ❯ qa.spec.ts:12:20
UI
Process completed with exit code 1.