`calloc` vs. `malloc` + `memset` for Zeroing

For large allocations, `calloc` can be significantly faster than `malloc` followed by `memset`, sometimes by a factor of 100x, due to kernel-level optimizations like lazy page zeroing and avoiding redundant page faults.

Sources

Open the full topic