Okay, that's a surprise. I had assumed the buffer would be mapped read-only. If indeed it needs to modify the buffer then even the memory gains start to look marginal. Thanks for explaining where my assumptions were wrong, and thanks also for confirming the parts that were right. I now know that the use-case I have in mind is likely better served by sed and not by grep.
-----Original Message----- From: Paul Eggert <egg...@cs.ucla.edu> Sent: Thursday, October 10, 2024 12:11 AM To: Yagnatinsky, Mark : IT (NYK) <mark.yagnatin...@barclays.com> Cc: 73721-d...@debbugs.gnu.org Subject: Re: bug#73721: grep perf docs barely mention mem usage CAUTION: This email originated from outside our organization - egg...@cs.ucla.edu Do not click on links, open attachments, or respond unless you recognize the sender and can validate the content is safe. ______________________________________________________________________ On 2024-10-09 14:12, mark.yagnatin...@barclays.com wrote: > With mmap(), the kernel just needs to set up a bit of book-keeping Yes, I'm sure than in some cases mmap would be a win. However, all in all it was found not to be, and I expect that the hassle of maintaining the mmap variant wasn't worth whatever benefits it provided. As I recall 'grep' wants to modify its input buffers for other efficiency reasons, and mmap CoW likely won't be a performance win over page-aligned read. We could be proved wrong by someone taking the time to resurrect --mmap and doing performance measurements of realistic benchmarks. I don't have the time for that, myself. This message is for information purposes only. It is not a recommendation, advice, offer or solicitation to buy or sell a product or service, nor an official confirmation of any transaction. It is directed at persons who are professionals and is intended for the recipient(s) only. It is not directed at retail customers. This message is subject to the terms at: https://www.ib.barclays/disclosures/web-and-email-disclaimer.html. For important disclosures, please see: https://www.ib.barclays/disclosures/sales-and-trading-disclaimer.html regarding marketing commentary from Barclays Sales and/or Trading desks, who are active market participants; https://www.ib.barclays/disclosures/barclays-global-markets-disclosures.html regarding our standard terms for Barclays Investment Bank where we trade with you in principal-to-principal wholesale markets transactions; and in respect to Barclays Research, including disclosures relating to specific issuers, see: https://publicresearch.barclays.com. __________________________________________________________________________________ If you are incorporated or operating in Australia, read these important disclosures: https://www.ib.barclays/disclosures/important-disclosures-asia-pacific.html. __________________________________________________________________________________ For more details about how we use personal information, see our privacy notice: https://www.ib.barclays/disclosures/personal-information-use.html. __________________________________________________________________________________