Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Split and join is worse because it allocates N junk strings, all of which have to be fully copied only to be copied again and then thrown away. This is the same problem as the "Array.push() is 945x faster than Array.concat()" post from last week: https://news.ycombinator.com/item?id=19991339

As I commented on the other post, all programmers really should spend some time learning how memory, pointers, data structures, heap vs stack, etc. work. Even if you aren't writing C++ at your day job, that stuff matters.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: