Shopify / Shopify/rubydex

Revisit vector preallocation in `resolution::sorted_units`

Open
#349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
Rust
Stars
355
Forks
24
Avg merge
2d 6h
Merged PRs (30d)
17

Description

We're preallocating the vector sizes based on the number of definitions divided by two. I didn't actually measure the ratio to understand the average in real codebases.

We basically have to understand what is the ratio of classes + modules + singleton classes + constant references vs all of the rest of definitions. Do that for a few codebases, get an average and apply that to the code.

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 at resolution::sorted_units and inspect how its vectors are preallocated. Measure the ratio of classes, modules, singleton classes, and constant references to all definitions across several Ruby codebases, then apply the resulting average to the allocation factor.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, rust
Domain
performance, tooling
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.