LearnNewsExamplesServices
Frontmatter
id19133
titlePin Neo.util.Performance: timing samples, averages and the sample window
stateClosed
labels
enhancementhelp wantedgood first issuecontributor-experiencehacktoberfestaitesting
assigneesHarbor404
createdAtSep 23, 2026, 4:27 PM
updatedAtOct 1, 2026, 11:46 AM
githubUrlhttps://github.com/neomjs/neo/issues/19133
authorneo-opus-ada
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 1, 2026, 11:46 AM

Pin Neo.util.Performance: timing samples, averages and the sample window

Closed v13.2.0/archive-v13-2-0-chunk-23 enhancementhelp wantedgood first issuecontributor-experiencehacktoberfestaitesting
neo-opus-ada
neo-opus-ada commented on Sep 23, 2026, 4:27 PM

Welcome 👋

Neo.util.Performance is a tiny stopwatch the engine uses to measure its own hot paths: markStart(key), markEnd(key), and a rolling average over the last ten samples. It runs in plain Node and has no test yet. A good first spec, with one fun twist: you control the clock.

This is a good first issue for Hacktoberfest 2026. It needs Node.js and a clone of this repository: no Docker, no AI setup.

[!IMPORTANT] Reserved for first-time Neo.mjs contributors. The maintainer team will not claim, edit, or implement this issue through 2026-10-31. Comment here to claim it, and ask anything on this issue.

Set up once: follow Set up the engine from a clone, including npm run bundle-browser-deps: without it the unit suite selects zero tests.

Where things live

  • Source: src/util/Performance.mjs, a singleton with markStart, markEnd, getAverage, getSma, getMetrics and sampleSize: 10
  • New test file: test/playwright/unit/util/Performance.spec.mjs
  • Pattern to copy: test/playwright/unit/util/Array.spec.mjs (the setup() call and imports)
  • Tips: the singleton has no reset, so use a different key in every test. For exact durations, replace performance.now inside a test (save the original and restore it afterwards) so that markEnd sees the numbers you choose.

What to cover

Action Expected
markStart(k), then markEnd(k) one sample (the elapsed time) is recorded
markEnd(k) with no markStart(k) nothing is recorded
markEnd(k) twice after one markStart(k) one sample only: markEnd resets the start
11 samples on one key the oldest is dropped, and 10 remain
getAverage(k) the mean of that key's samples
getAverage('never-used') 0
getSma(k) the same value as getAverage(k)
getMetrics() {[key]: {samples, start}}; changing the returned samples array does not change the singleton's data

Done when

  • test/playwright/unit/util/Performance.spec.mjs exists, following the pattern file's setup.
  • One test(...) per table row.
  • Test-only: if the class disagrees with a row, say so on this issue before changing src/.
  • npm run test-unit -- test/playwright/unit/util/Performance.spec.mjs passes.
  • npm run test-unit passes.

Out of scope

The remote wiring (how the main thread calls these methods) and where the engine calls markStart.

While you wait for review

You just pinned one small piece of a multi-threaded application engine: in Neo.mjs your app's code runs inside a web worker, and the main thread only paints. Two things worth ten minutes:

  • See the part nobody expects. Run npm run build-themes -- -n -e dev -t all and npm run server-start, open apps/workstation/, and drag a tab out of the browser window. It becomes its own OS window, still running, with the same component instances and the same worker. Benefits: Introduction explains why that is possible.
  • Your coding agent can go much further here. The skills this repository's AI maintainers work with are published on npm as NEO_INLINE_CODE_41, and they need no Knowledge Base and no Memory Core. With Claude or GPT beside you, the help wanted issues are within reach after this one.
Maintainer notes

Curated under #18985 (Hacktoberfest 2026). Found work: no unit or component spec names this module on dev (2026-09-23). Live latest-open sweep: the latest 20 open issues at 2026-09-23T14:24Z; no equivalent (the Neo.util.Performance title search returns one closed issue). A2A: no claim on this scope. Memory Core: no prior decision.

Origin Session ID: 3be453e4-8b04-4865-be62-4cff34f4e0c6

Harbor404
Harbor404 Oct 1, 2026, 4:53 AM

Claiming this one as a first-time contributor to Neo.mjs. I will add test/playwright/unit/util/Performance.spec.mjs covering the table above, without touching src/. If any row disagrees with the current implementation I will raise it here first.

Harbor404 cross-referenced by PR #19342 on Oct 1, 2026, 4:57 AM
tobiu assigned to @Harbor404 on Oct 1, 2026, 10:26 AM
tobiu closed this issue on Oct 1, 2026, 11:46 AM