You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/posts/2026-02-25-arraylist-vs-linkedlist-cache-locality/index.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,9 +175,9 @@ McCalpin은 이미 1990년대 중반에 "cache miss 한 번 처리하는 동안
175
175
176
176
- pointer chasing이 과거에 없던 문제가 된 게 아니라
177
177
-**예전보다 miss penalty(특히 cycle 기준)가 더 커져서**
178
-
- locality 차이가 실제 벽시계 시간에 더 크게 번역되기 쉬워졌습니다.
178
+
- locality 차이가 실제 수행 시간에 더 크게 반영되기 쉬워졌습니다.
179
179
180
-
즉 "옛날엔 LinkedList도 충분히 빨랐다"는 단정은 조심해야 하지만, "현대 CPU에서는 locality를 놓치면 비용이 더 빠르게 커진다"는 방향은 역사적으로도 일관된 설명입니다.
180
+
즉 현대 CPU에서는 캐시 때문에 locality를 놓치면 비용이 더 커집니다.
181
181
182
182
[^memory-wall]: Wulf, McKee, "Hitting the Memory Wall: Implications of the Obvious" (1995) — https://libraopen.lib.virginia.edu/downloads/4b29b598d
183
183
[^mccalpin-balance]: John D. McCalpin, "Memory Bandwidth and Machine Balance in Current High Performance Computers" (1995) — https://www.cs.virginia.edu/~mccalpin/papers/balance/
@@ -240,12 +240,12 @@ Big-O는 여전히 중요합니다. 다만 **현대 CPU에서 데이터가 어
240
240
|`buildFromPayload` 시간 (ns/op) | 65536 | 100677.722 | 158964.547 | LinkedList가 약 1.58배 느림 |
241
241
|`buildFromPayload` 할당량 (B/op) | 65536 | 262186.3 | 1572867.7 | LinkedList가 약 6.00배 더 많이 할당 |
242
242
243
-
즉 이 케이스에서는 LinkedList가 실행시간뿐 아니라, 노드 객체 생성 비용 때문에 메모리 할당량에서도 명확히 불리했습니다.
243
+
즉 이 벤치마크에서는 LinkedList가 실행시간뿐 아니라, Node 객체 생성 비용 때문에 메모리 할당량에서도 불리했습니다.
244
244
245
245
관찰 포인트는 세 가지입니다.
246
246
247
247
1.`getMiddle`처럼 임의 접근 성격이 강한 연산은 Array 계열(`ArrayList`)이 압도적으로 유리합니다.
248
-
2.`head insert/remove`, `iterator remove`처럼 노드 재연결이 핵심인 연산은 `LinkedList`가 매우 크게 앞섭니다.
0 commit comments