lspitzner / lspitzner/pqueue

Should queues track size?

Open
#25 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Haskell
Stars
17
Forks
12
PR merge metrics
No merged PRs in 30d

Description

It's possible to calculate the size in amortized `O(log n)` time. Once #24 is finished, that will improve to worst-case `O(log n)` time (except in the presence of pathological nesting of `mapMonotonic` calls). Is it really worth tracking the size to get that to `O(1)`? It's not terribly expensive, but it's one more word of allocation on `insert`.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Review this issue and the proposed work in #24 first. Compare the cost of tracking queue size during insert with the current amortized O(log n) size calculation, including the stated mapMonotonic nesting caveat. Done means reaching and documenting a clear decision about whether constant-time size tracking should be added.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
data, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.