[1]에서 문자열을 다룰 때 StrictTextBuilder의 성능을 비교하는 예제에서 Builder의 성능이 더 좋다고 설명한다. 그런데 내 PC에서 같은 코드를 실행했는데 결과가 반대로 나왔다. 이상해서 문자열 길이를 늘렸더니 책에서 말한대로 나왔다.

ghci> concatSpeedTest 50000
0.004451s
0.04721s
ghci> concatSpeedTest 500000
0.062405s
0.023449s
ghci> concatSpeedTest 5000000
0.511402s
0.205632s

  1. Chris Martin, Julie Moronuki, 《Sockets and Pipes》 ↩︎

3

If you have a fediverse account, you can quote this note from your own instance. Search https://hackers.pub/ap/notes/019632ef-21a1-7f7d-9cd6-afd9c950909e on your instance and quote it. (Note that quoting is not supported in Mastodon.)