Skip to content

Convert Vec<T> to Box<[T]> - #195

Merged
Kronos3 merged 5 commits into
mainfrom
convert-vec-to-slice-box
Sep 4, 2026
Merged

Convert Vec<T> to Box<[T]>#195
Kronos3 merged 5 commits into
mainfrom
convert-vec-to-slice-box

Conversation

@Kronos3

@Kronos3 Kronos3 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

I originally wrote Vec<T> to store len: u32 and capacity: u32 because for 64-bit this would fix in two words. This was nasty and not correct and required a lot of as u32 casts...

We only need to store len during the construction of the module/section. I converted stored members to use Box<[T]> which is a fat pointer of two words already but cannot increase in length. This does not make in size on 64-bit but decreases size on 32-bit from 12 bytes to 8 bytes.

@Kronos3
Kronos3 force-pushed the convert-vec-to-slice-box branch from 49b3b50 to 27a97ab Compare September 4, 2026 00:53
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

CoreMark Benchmark Results

Current Score: 239.292
Baseline Score (main): 230.787
Difference: +8.505 (3.69%)

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Coverage Report

Current Coverage: 95.46%
Baseline Coverage (main): 95.39%
Difference: +0.07%

@Kronos3
Kronos3 merged commit bae54ed into main Sep 4, 2026
20 checks passed
@Kronos3
Kronos3 deleted the convert-vec-to-slice-box branch September 4, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant