Padding in a large array's elements
over 20% of a large array's element is padding
let a: [200000](w: Int, b: Bool) = [200000].filled((w: 0, b: false))
print(a[0].w)let w: [200000]Int = 0
let b: [200000]Bool = false
print(w[0], yes(b[0]))Why
A tuple or struct element is aligned to its widest field, so (w: Int, b: Bool) holds 9 bytes of data in 16. Over a large array that is memory and cache spent on nothing. Store it as Packed<S> (data only, unaligned loads), with layout: columns (one array per field), or as separate arrays per field when only some fields are read together.
The practice it serves
Code that does more work than it needs to.
Not flagged
A near miss: close to the pattern, but not it.
let a: [200000](w: Int, v: Int) = [200000].filled((w: 0, v: 0))
print(a[0].w)Turn it off
For one block, wrap it in with lint(padding: allow):. For a project, add padding = "allow" under [lints] in cp.toml.
Generated from spec/checker-lints/padding, the same record the linter is built from.