# Rust 정렬에서 to_lowercase() 대신 반복자 비교가 느린 이유

Original title: Matching Puzzle Pieces and Disappointing Benchmarks

> Hacker News story 49554848 · language: ko · submitted 2026-09-03
> Web version: https://zeli.app/ko/story/49554848
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 6 · by [speckx](<https://news.ycombinator.com/user?id=speckx>) · 💬 0
[original](<https://llogiq.github.io/2026/03/20/case.html>) · [HN discussion](<https://news.ycombinator.com/item?id=49554848>)

## Summary

Rust에서 문자열을 대소문자 구분 없이 정렬할 때, 각 요소에 대해 to_lowercase()를 호출해 메모리를 할당하는 대신 문자 반복자를 사용해 비교하는 방법이 더 빠를 것이라는 가정을 벤치마크로 검증했다. 결과는 예상과 달리, 반복자 기반 비교는 할당을 피하는 이점을 상쇄할 만큼 느렸다. 특히 unicase 크레이트가 복잡한 비교에도 불구하고 더 빠른 경우가 많아 주목할 만하다. sort_by_cached_key가 여전히 효율적임을 확인했다.

## Key quote

> 진짜 놀라운 점은 unicase가 비교를 더 복잡하게 만드는데도 종종 더 빠를 수 있다는 것이다.

---

## Cite

- Page: https://zeli.app/ko/story/49554848
- Date: 2026-09-03
- Source: llogiq.github.io (https://llogiq.github.io/2026/03/20/case.html)
- Hacker News: https://news.ycombinator.com/item?id=49554848

## Other languages

- en: https://zeli.app/story/49554848 · markdown: https://zeli.app/story/49554848.md
- zh: https://zeli.app/zh/story/49554848 · markdown: https://zeli.app/zh/story/49554848.md
- ja: https://zeli.app/ja/story/49554848 · markdown: https://zeli.app/ja/story/49554848.md
- de: https://zeli.app/de/story/49554848 · markdown: https://zeli.app/de/story/49554848.md
- es: https://zeli.app/es/story/49554848 · markdown: https://zeli.app/es/story/49554848.md
- ru: https://zeli.app/ru/story/49554848 · markdown: https://zeli.app/ru/story/49554848.md
