You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6447353
Browse filesBrowse the repository at this point in the historyBrowse files
Alignment sweep of the Vector API addition on the M5 Pro
With every array on a 16-byte boundary, the vector loop is as fast as
the auto-vectorized scalar loop only when it starts after 0 or 4 scalar
elements, i.e. when its loads and stores are 16-byte aligned: 43.7 and
46.7 ns for 1,000 elements against 45.1 ns. Every other start takes
53 to 59 ns.
Copy file name to clipboardExpand all lines: results/apple-m5-pro-arm64/benchmarks/supplementary/README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Run on 2026-11-15 right after the main run in `../results.json`, on the same mac
10
10
|`add-masked-tail-allocations.txt`| Where `vectorMasked` with 1,003 elements allocates: Java Flight Recorder allocation samples, grouped by class and stack. The objects come from `fromArray()` on the in-range path (`FloatVector.java` line 2895 in JDK 27), i.e. also in the iterations with a full mask, and from `add()`|
11
11
|`add-masked-tail-variants`|`AddBenchmark.vector`, `vectorMasked` and `vectorMaskedTail` with 7, 1,000, 1,003 and 100,003 elements, with the GC profiler. `vectorMaskedTail` (added on the i7-12700H) keeps the main loop unmasked and masks only the one partial iteration at the end. On NEON that iteration allocates 176 bytes with 1,003 elements and costs about 35 ns; the main loop stays free of allocations |
12
12
|`add-masked-tail-with-and-without-tail`|`AddBenchmark.vector` and `vectorMaskedTail` with 100,000, 100,003 and 100,008 elements, with the GC profiler: only 100,003 needs a masked tail, and only there does `vectorMaskedTail` allocate (240 bytes per call) |
13
+
|`add-alignment-sweep`|`AddAlignmentBenchmark.vectorAfterHead` with a head of 0 to 7 scalar elements before the vector loop, and `AddBenchmark.scalar`, with 1,000 and 100,000 elements, under `-XX:-UseCompactObjectHeaders -XX:ObjectAlignmentInBytes=16`. Every array then starts at a 16-byte boundary, so the vector accesses are 16-byte aligned for a head of 0 and 4 only. Exactly these two are as fast as the scalar loop; all other heads take about 20 % longer |
13
14
|`add-16-byte-aligned-arrays`|`AddBenchmark.scalar` and `vector` with `-XX:-UseCompactObjectHeaders -XX:ObjectAlignmentInBytes=16`, which puts the first element of every array on a 16-byte boundary |
14
15
15
16
Commands, run from the repository root after `scripts/run-benchmarks.sh` had built the benchmarks:
0 commit comments