Skip to content

Commit 7760d45

Browse files
committed
updating benchmarks and readme
1 parent 7e6d2ae commit 7760d45

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,24 @@ soa {
168168
169169
Benchmark
170170
-------
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.
172172
Here are the results using Visual Studio 2022 on Release mode on my laptop.
173173
174174
```
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
180189
```
181190
182191
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.

benchmarks.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct TestCase {
6262
t.measurements_vec.push_back(m);
6363
t.measurements_soa.insert(m.sensor_id, m.object_id, m.timestamp, m.data);
6464
}
65+
t.measurements_soa.prepare_tmp();
6566
return t;
6667
}
6768
};

0 commit comments

Comments
 (0)