OS Optimizations: `calloc`'s Hidden Speed Advantage

Operating systems often optimize `calloc` by providing pre-zeroed memory pages or using 'copy-on-write' mechanisms, where physical pages are only zeroed and allocated when first written to, giving `calloc` an advantage for large, potentially unused, zero-initialized blocks.

Sources

Open the full topic