python-trio / python-trio/trio

use a heap instead of sorteddict?

Open
#385 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
Python
Stars
7.3k
Forks
431
Avg merge
2d 17h
Merged PRs (30d)
6

Description

I see trio depends on sortedcontainers solely because it needs a priority queue for sorting deadlines and the similar, and the Python standard library has one (heapq) for that exact purpose.

Pros:

  • one less dependency
  • it's (at least) slightly faster (13.29s vs 12.97s running the tests; it varies but the fastest sortedcontainers one took the same time as the slowest heap one)

Cons:

  • may introduce bugs
  • I have only a rough implementation, need some work to send a pull request

What do you think?

Contributor guide

Open the contributing guide

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 locating Trio's deadline priority queue and the sortedcontainers dependency, then read the heapq documentation linked in the issue. Compare the rough heap implementation with the existing behavior and run the test suite; done means the dependency can be removed without regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.