Journal-finished gate in walkForRetired is O(entries x generations)

Open
#2,023 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript
Domain
performance

Research direction

Read src/core/cache/maintenance.js around lines 2682 and 2758 to understand the generation-membership checks in walkForRetired. The acceptance condition is to use one Set for both checks when those checks are next modified; the issue describes this as a deferred, immaterial cleanup, not an urgent task.

Written by the indexing model from the issue text.

Description

Source: #2017 at 6bd3752d4a7e0f3fa70881e5f5e6a8c42aff5854
Location: src/core/cache/maintenance.js:2758
Severity: low

Evidence

entries.some(entry => cleanup.generations.includes(entry.name)) is O(entries x generations) per tick for a partition with a journal, and the short circuit only helps while a named generation is still present. The identical shape is already paid by the pre-existing per-entry includes at maintenance.js:2682.

Why deferral is safe

Bounded and measured immaterial: both loops are bounded by one partition's generation directory count (typically one to three, capped at 10000 by purge-cleanup.js:73), the gate allocates nothing and issues no syscall, and hoisting a Set would mean editing a line outside this PR's diff for no measurable gain. This is a cleanup for whenever that loop is next touched, per the repo's performance threshold (a measured-immaterial nit is a preference).

Acceptance condition

When walkForRetired's generation-membership checks are next modified, hoist cleanup.generations into a Set used by both the per-entry check at maintenance.js:2682 and the finished-journal gate at :2758.

Review preference; backlog only. A human may explicitly delegate it with neutral:fix.

Dominant language
JavaScript
Stars
11
Forks
0
Avg merge
2h 55m
Merged PRs (30d)
294

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyparam/hypaware

All issues in hyparam/hypaware

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.