Commit 93c530f
bors-servo
Auto merge of #94 - arthurprs:union, r=mbrubeck
Use a union to reduce the size of SmallVec [v2]
Building on top of #92 by @Amanieu
I introduced `triple()` and `triple_mut()` which removed almost all of the runtime overhead. Performance is very comparable.
```
name master:: ns/iter union:: ns/iter diff ns/iter diff % speedup
bench_extend 45 47 2 4.44% x 0.96
bench_extend_from_slice 45 43 -2 -4.44% x 1.05
bench_from_slice 45 44 -1 -2.22% x 1.02
bench_insert 615 622 7 1.14% x 0.99
bench_insert_from_slice 101 99 -2 -1.98% x 1.02
bench_insert_many 309 266 -43 -13.92% x 1.16
bench_macro_from_elem 41 37 -4 -9.76% x 1.11
bench_macro_from_list 40 42 2 5.00% x 0.95
bench_push 381 370 -11 -2.89% x 1.03
bench_pushpop 404 420 16 3.96% x 0.96
bench_remove 458 436 -22 -4.80% x 1.05
```
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/94)
<!-- Reviewable:end -->4 files changed
+287
-171
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | | - | |
11 | 9 | | |
| 10 | + | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
| 161 | + | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
0 commit comments