upvote
> all these numbers are way too small to make meaningful distinctions. Come back when you have a gigabyte.

I have to disagree. Bad performance is often a result of a death of a thousands cuts. This function might be one among countless similarly inefficient library calls, programs and so on.

reply
If you're not putting a representative amount of data through the test, you have no idea if the resource usage you're seeing scales with the amount of data or is just a fixed overhead if the runtime.
reply
deleted
reply
> how big is the text file? I bet it's a megabyte, isn't it?

The edit in the article says ~1.5kb

reply
Single page on many systems, which makes using mmap() for it even funnier.
reply
Not to mention inefficient in memory use. I would have expected a mention of interning; using string-views is fine, but making it a view of 4kB cache pages is not really.

Though I believe the “naive” streaming read could very well be superior here.

reply
[dead]
reply
[dead]
reply