Hacker News new | ask | show | jobs
by krapp 4476 days ago
That is interesting...I would have assumed concatenating arrays was slower anyway.

Would it be relevant to test this using file reads?

1 comments

Yeah, as I note in the docs it's pretty Trival and a quick 10 minute hack around :) Don't take it all too serious. But the last point about .NET and StringBuilder() used to hang around in my head during the dark days of my early ASP.NET development.

Not sure about the file reads, defeating string interning seemed to be the point that helped show any really difference. Quite an interesting/cool topic that.

Unless PHP has truly awful string concatenation performance, your microbenchmark will spend almost all of its time generating pseudorandom numbers, and a tiny fraction of its time moving bytes around to concatenate strings.