WebAssembly / WebAssembly/binaryen

SmallVector could call constructors only when relevant

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

Nobody has claimed this yet.

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

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.

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

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.

Assessment

Tech stack
cpp
Domain
compilers, performance
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.