BACKEND·중요도 6·2026. 06. 22.·r/programming
How 4 bytes of padding make array clearing 49% faster
── KO ──────────────────
4바이트 패딩이 배열 초기화를 49% 빠르게 만든다는 연구.
이 글은 amd64 특성에 관한 흥미로운 퀴리로, 큰 배열이 4바이트 정렬이 안 되어 있으면 8바이트 정렬로 바꾸는 것이 배열 초기화를 약 49% 빠르게 만든다고 설명합니다. 해당 연구는 인텔 기계에서의 일이지만, 인텔의 REP STOSQ 구현 및 ERMS 등의 다른 최적화 관련 내용도 다룹니다.
── EN ──────────────────
4 bytes of padding can make array clearing 49% faster, based on amd64 quirks.
This article discusses an interesting amd64-specific quirk where making a large array 8-byte aligned from a 4-byte misaligned state can result in approximately 49% faster clearing. The findings were observed on an Intel machine, and the post also touches on Intel's REP STOSQ implementation and other related optimizations for array clearing.