SmallVector could call constructors only when relevant

Open
#4,452 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Locate the SmallVector implementation and inspect how its fixed std::array storage constructs elements, then follow the Literals and Literal usage mentioned in the issue. Compare the current behavior with an approach that constructs elements only as the size increases, and verify both correctness and whether the relevant profile improves.

Written by the indexing model from the issue text.

Description

The fixed storage there is a std::array which constructs the items immediately. We could instead use a different approach that only calls the constructor when the size actually increases.

This looks like it might be a noticeable speedup as I see profile data in which Literals, a SmallVector of Literal, is fairly high. The Literal constructor is apparently not cheap.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
2d 1h
Merged PRs (30d)
70

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.

More from WebAssembly/binaryen

All issues in WebAssembly/binaryen

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.