]> git.proxmox.com Git - libgit2.git/commit - src/util/futils.c
fileops: stat() before open()ing in git_futils_readbuffer_updated()
authorBrodie Rao <brodie@sf.io>
Tue, 13 Aug 2013 17:55:37 +0000 (10:55 -0700)
committerBrodie Rao <brodie@sf.io>
Tue, 13 Aug 2013 17:55:37 +0000 (10:55 -0700)
commit9ccdb21155b3c9650acf58c55b2596c3503ea14d
treece304d88b61c99aaa8c73ff7894512882ac64174
parent14da618260be02c63b4f08dca8e6ab479f7449d7
fileops: stat() before open()ing in git_futils_readbuffer_updated()

This reverts refactoring done in 13224ea4aad9a1b3c9cc4c992ceaea9af623e047
that introduces a performance regression for NFS when reading files that
don't exist. open() forces a cache invalidation on NFS, while stat()ing a
file just uses the cache and is very quick.

To give a specific example, say you have a repo with a thousand packed
refs. Before this change, looking up every single one ould incur a thousand
slow open() calls. With this change, it's a thousand fast stat() calls.
src/fileops.c