Skip to content

Conversation

@SOF3
Copy link

@SOF3 SOF3 commented Oct 11, 2025

Implements the optimization as proposed in #58, renaming the proposed method from push_unchecked to push_reserved for clarity.

Benchmarks

Benchmarks of <ThinVec as From<[u16; N]>>::from(array) show the following improvements.

Environment: Linux 6.16.7-arch1-1, rustc 1.91.0-beta.4, x86_64-unknown-linux-gnu, Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz

N = 13:

criterion:
image

iai:

bench_thinvec_from_array_and_drop_large
  Instructions:                 331 (-37.66478%)
  L1 Accesses:                  426 (-38.61671%)
  L2 Accesses:                    3 (+50.00000%)
  RAM Accesses:                  14 (-22.22222%)
  Estimated Cycles:             931 (-30.20990%)

N = 1027:

criterion:
image

iai:

bench_thinvec_from_array_and_drop_huge
  Instructions:                 782 (-94.47896%)
  L1 Accesses:                 1063 (-94.26645%)
  L2 Accesses:                    7 (-80.00000%)
  RAM Accesses:                  90 (-4.255319%)
  Estimated Cycles:            4248 (-80.69530%)

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