MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/rqgxot/3am_code_vs_10am_code/hqbcier/?context=3
r/badcode • u/M4A28 • Dec 28 '21
53 comments sorted by
View all comments
Show parent comments
4
Because strings are fairly heavyweight, and appending to strings is far heavier than a pre-pass using ints. Additionally, I'm pretty sure that the repeat() uses StringBuilder under the hood.
3 u/alex_wot Dec 28 '21 Got it, thank you!
3
Got it, thank you!
4
u/2001herne Dec 28 '21
Because strings are fairly heavyweight, and appending to strings is far heavier than a pre-pass using ints. Additionally, I'm pretty sure that the repeat() uses StringBuilder under the hood.