4 ms·
That's an interesting point. When arithmetic and memory accesses cost about the same, pointer chasing through graphs works great. The currently popular struct-o
by JonChesterfield 3y ago
That's an interesting point. When arithmetic and memory accesses cost about the same, pointer chasing through graphs works great. The currently popular struct-of-arrays and cache oblivious datastructure patterns only really make sense when arithmetic is essentially free relative to memory.
- kragen 3y agofortran and proto-fortran programmers were using parallel arrays (aka 'struct-of-arrays') since the 01950s, and if you read sutherland's dissertation, you'll see that that parallel array patterns were just the default way of structuring data in computer memories, to the point that they didn't have a name and sutherland felt he had to justify doing things differently, and neither basic nor fortran supported records (structs). the only arithmetic you need to access attribute aa of object oo in parallel arrays is base + (oo << sizebits), and in the usual case, sizebits was 0, the addition was done implicitly by the index-register hardware, and base was an immediate operand in the instruction and so didn't need a separate fetch operation. this is quite comparable to the arithmetic needed for the record/struct approach: oo + offset, where offset is an immediate operand as i understand it, the reason we switched to conventionally using records was not because of efficiency, nor even to support pointer chasing through graphs (you can totally make linked lists in parallel arrays), but for reasons of memory allocation and dynamic object lifetimes