On Mon, Feb 22, 2010 at 10:40:59AM -0500, Nicolas Pitre wrote:That holds if you're comparing read() and mmap() of the entire file as a single chunk, instead of in fixed-size chunks at the sweet spot between syscall overhead and CPU cache size. If you're read()ing a chunk at a time into a fixed size buffer, and doing sha1 and deflate in chunks, the data should be copied once into CPU cache, processed with both algorithms, and replaced with new data from the next chunk. The data will be copied from the page cache instead of directly mapped, which is a small overhead, but setting up the page map in mmap() also a small overhead, so you have to use benchmarks to know which of the overheads is smaller. It might be that there's no one answer that applies to all CPU configurations. If you're doing mmap() and sha1 and deflate of a 50MB file in two separate passes that are the same size as the file, you load 50MB of data into CPU cache at least twice, you get two sets of associated things like TLB misses, and if the file is very large, you page it from disk twice. So it might make sense to process in chunks regardless of read() vs mmap() fetching the data. If you're malloc()ing 50MB, you're wasting memory and CPU bandwidth making up pages full of zeros before you've even processed the first byte. I don't see how that could ever be faster for large file cases. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
