code wiki / _hdl_build / nx_dod_cache.nx
nx_dod_cache.nx
buildroot/runtime/_hdl_build/nx_dod_cache.nx
about
nx_dod_cache.nx -- P3: measured cache-traffic model for DATA-ORIENTED (SoA/ECS) vs ARRAY-OF-STRUCTS
(AoS / classic OOP layout). When a system uses A of F fields per entity: AoS drags the WHOLE struct
array through cache (you pay for all F fields even though you use A); SoA stores each field contiguously
so you stream only the A arrays you touch. Memory traffic (cache lines) is the binding cost on weak
cores (deep-research: DOD = "efficient usage of the CPU cache ... SoA vs AoS"). Pure integer. license_tier: ORIGINAL
dependencies 0 imports · 1 importers
imports: none
imported by: nx_dod_cache_gate.nx
structs
| none |
consts
| 7 | const DC_BELOW: i64 = 0 |
| 8 | const DC_PARITY: i64 = 1 |
| 9 | const DC_EXCEEDS: i64 = 2 |
functions
| 11 | func dc_ceil_div(a: i64, b: i64) -> i64 { return (a + b - 1) / b } |
| 14 | func dc_aos_lines(n: i64, fields: i64, bpf: i64, line: i64) -> i64 { return dc_ceil_div(n * fields * bpf, line) } |
| 16 | func dc_soa_lines(n: i64, accessed: i64, bpf: i64, line: i64) -> i64 { return dc_ceil_div(n * accessed * bpf, line) } |
| 19 | func dc_verdict(aos: i64, soa: i64) -> i64 called by 1: main |
| 26 | func dc_aos_util_permil(accessed: i64, fields: i64) -> i64 { return accessed * 1000 / fields } called by 1: main |