|
|
Subscribe / Log in / New account

Two new ways to read a file quickly

Two new ways to read a file quickly

Posted Mar 7, 2020 18:06 UTC (Sat) by zlynx (guest, #2285)
In reply to: Two new ways to read a file quickly by intgr
Parent article: Two new ways to read a file quickly

Power of two sized buffers turn out to be a memory wasting trap though.

There was a blog article I read a while ago, linked off Hacker News I think, talking about some research into memory usage this programmer had done. It turned out that many allocations for buffers of sizes such as 4,096 bytes ended up having 16 bytes or so added to it. This was for memory allocation tracking, or if passed into some API the library would put it into a structure with other variables.

If I remember correctly the author determined that allocating 4,000 bytes was a nice round number that tended to round up to a 4,096 page size much more reliably.


to post comments

Two new ways to read a file quickly

Posted Mar 19, 2020 12:43 UTC (Thu) by mgedmin (subscriber, #34497) [Link]

Was it https://blog.mozilla.org/nnethercote/2011/08/05/clownshoe... That was a great article from a Firefox developer working on memory optimization.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds