JuliaCollections / JuliaCollections/DataStructures.jl

`PriorityQueue`s iteration slower than necessary

Open
#792 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
745
Forks
261
PR merge metrics
No merged PRs in 30d

Description

Compare these

julia> using DataStructures, BenchmarkTools

julia> pq = PriorityQueue(1 => 0.2, 2=>0.3)
PriorityQueue{Int64, Float64, Base.Order.ForwardOrdering} with 2 entries:
  1 => 0.2
  2 => 0.3

julia> @btime first(pq)
  119.160 ns (8 allocations: 736 bytes)
1 => 0.2

julia> @btime pq.xs[1]
  29.283 ns (2 allocations: 64 bytes)
1 => 0.2

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

Start by examining the PriorityQueue implementation behind first(pq) and compare it with the direct pq.xs[1] access shown in the report. Confirm the benchmark difference and identify the relevant iteration or lookup path; done means retrieving the first entry is no slower than necessary while preserving the reported result.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.