File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -168,15 +168,24 @@ soa {
168
168
169
169
Benchmark
170
170
-------
171
- We can observe speed ups for structure of arrays (soa=vapid::soa) vs array of structs (vec=std::vector) with the toy program benchmark .cc.
171
+ We can observe speed ups for structure of arrays (soa=vapid::soa) vs array of structs (vec=std::vector) with the benchmarks .cc.
172
172
Here are the results using Visual Studio 2022 on Release mode on my laptop.
173
173
174
174
```
175
- benchmark results ==============
176
- soa sort time 0.126592
177
- vec sort time 0.312302
178
- soa timestamp avg time 0.0018725
179
- vec timestamp avg time 0.0052643
175
+ # bazel run -c opt //: benchmarks
176
+ Run on (8 X 2995 MHz CPU s)
177
+ CPU Caches:
178
+ L1 Data 48 KiB (x4)
179
+ L1 Instruction 32 KiB (x4)
180
+ L2 Unified 1280 KiB (x4)
181
+ L3 Unified 12288 KiB (x1)
182
+ ---------------------------------------------------------------
183
+ Benchmark Time CPU Iterations
184
+ ---------------------------------------------------------------
185
+ BM_SoaSortBySensorId 10599404 ns 9151786 ns 70
186
+ BM_VecSortBySensorId 24412036 ns 25111607 ns 28
187
+ BM_SoaSumTimestamps 106078 ns 106027 ns 5600
188
+ BM_VecSumTimestamps 264606 ns 266841 ns 2635
180
189
```
181
190
182
191
The benchmark contains a small program concerning simulated sensor measurements. With a straightforward array of structs, we store metadata together with the actual sensor data together and then just push_back() these onto an std::vector.
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ struct TestCase {
62
62
t.measurements_vec .push_back (m);
63
63
t.measurements_soa .insert (m.sensor_id , m.object_id , m.timestamp , m.data );
64
64
}
65
+ t.measurements_soa .prepare_tmp ();
65
66
return t;
66
67
}
67
68
};
You can’t perform that action at this time.
0 commit comments