* [PATCH] read-cache: increase write buffer size
@ 2016-03-19 1:19 David Turner
2016-03-19 8:05 ` Torsten Bögershausen
2016-03-19 11:18 ` Duy Nguyen
0 siblings, 2 replies; 5+ messages in thread
From: David Turner @ 2016-03-19 1:19 UTC (permalink / raw)
To: git; +Cc: David Turner
Each write() has syscall overhead, and writing a large index entails
many such calls. A larger write buffer reduces the overhead,
leading to increased performance.
On my repo, which has an index size of 30m, this saves about 10ms of
time writing the index.
Signed-off-by: David Turner <dturner@twopensource.com>
---
read-cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/read-cache.c b/read-cache.c
index d9fb78b..09ebe08 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1714,7 +1714,7 @@ int unmerged_index(const struct index_state *istate)
return 0;
}
-#define WRITE_BUFFER_SIZE 8192
+#define WRITE_BUFFER_SIZE 131072
static unsigned char write_buffer[WRITE_BUFFER_SIZE];
static unsigned long write_buffer_len;
--
2.4.2.767.g62658d5-twtrsrc
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] read-cache: increase write buffer size
2016-03-19 1:19 [PATCH] read-cache: increase write buffer size David Turner
@ 2016-03-19 8:05 ` Torsten Bögershausen
2016-03-19 10:25 ` Pranit Bauva
2016-03-19 11:18 ` Duy Nguyen
1 sibling, 1 reply; 5+ messages in thread
From: Torsten Bögershausen @ 2016-03-19 8:05 UTC (permalink / raw)
To: David Turner, git
On 2016-03-19 02.19, David Turner wrote:
> Each write() has syscall overhead, and writing a large index entails
> many such calls. A larger write buffer reduces the overhead,
> leading to increased performance.
>
> On my repo, which has an index size of 30m, this saves about 10ms of
> time writing the index.
>
> Signed-off-by: David Turner <dturner@twopensource.com>
> ---
> read-cache.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/read-cache.c b/read-cache.c
> index d9fb78b..09ebe08 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -1714,7 +1714,7 @@ int unmerged_index(const struct index_state *istate)
> return 0;
> }
>
> -#define WRITE_BUFFER_SIZE 8192
> +#define WRITE_BUFFER_SIZE 131072
> static unsigned char write_buffer[WRITE_BUFFER_SIZE];
> static unsigned long write_buffer_len;
>
>
Do I read that right, it saves 10 milliseconds ?
What happens to small system (like Raspberry PI), when you
want 128K write buffer ?
Could the buffer size be turned into a makefile variable, defaulting to 8192 ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] read-cache: increase write buffer size
2016-03-19 8:05 ` Torsten Bögershausen
@ 2016-03-19 10:25 ` Pranit Bauva
0 siblings, 0 replies; 5+ messages in thread
From: Pranit Bauva @ 2016-03-19 10:25 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: David Turner, Git List
On Sat, Mar 19, 2016 at 1:35 PM, Torsten Bögershausen <tboegi@web.de> wrote:
> On 2016-03-19 02.19, David Turner wrote:
>> Each write() has syscall overhead, and writing a large index entails
>> many such calls. A larger write buffer reduces the overhead,
>> leading to increased performance.
>>
>> On my repo, which has an index size of 30m, this saves about 10ms of
>> time writing the index.
>>
>> Signed-off-by: David Turner <dturner@twopensource.com>
>> ---
>> read-cache.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/read-cache.c b/read-cache.c
>> index d9fb78b..09ebe08 100644
>> --- a/read-cache.c
>> +++ b/read-cache.c
>> @@ -1714,7 +1714,7 @@ int unmerged_index(const struct index_state *istate)
>> return 0;
>> }
>>
>> -#define WRITE_BUFFER_SIZE 8192
>> +#define WRITE_BUFFER_SIZE 131072
>> static unsigned char write_buffer[WRITE_BUFFER_SIZE];
>> static unsigned long write_buffer_len;
>>
>>
> Do I read that right, it saves 10 milliseconds ?
> What happens to small system (like Raspberry PI), when you
> want 128K write buffer ?
> Could the buffer size be turned into a makefile variable, defaulting to 8192 ?
Maybe for all ARM devices not just Raspberry Pi.
There is one way, though its not that good. This is just a sample
code. I am unsure about if using bash in makefile is a good idea
in Makefile,
uname -a | grep "arm" >out
if [ -s out ]; then
export ARM=arm
fi
rm out
in read-cache.c,
#define ARCH (getenv("ARCH"))
#ifdef ARCH,
#define WRITE_BUFFER_SIZE 128000
#endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] read-cache: increase write buffer size
2016-03-19 1:19 [PATCH] read-cache: increase write buffer size David Turner
2016-03-19 8:05 ` Torsten Bögershausen
@ 2016-03-19 11:18 ` Duy Nguyen
2016-03-21 16:22 ` David Turner
1 sibling, 1 reply; 5+ messages in thread
From: Duy Nguyen @ 2016-03-19 11:18 UTC (permalink / raw)
To: David Turner; +Cc: Git Mailing List
On Sat, Mar 19, 2016 at 8:19 AM, David Turner <dturner@twopensource.com> wrote:
> Each write() has syscall overhead, and writing a large index entails
> many such calls. A larger write buffer reduces the overhead,
> leading to increased performance.
>
> On my repo, which has an index size of 30m, this saves about 10ms of
> time writing the index.
I wonder if split-index does not work as intended. Because if it does,
you should rarely need to write that such big index files (or is this
30mb the small part and the base index is even bigger?).
But I agree with Torsten that we should make this configurable,
preferably via config file, if not we can still move this define back
in Makefile, overridable using config.mak
--
Duy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] read-cache: increase write buffer size
2016-03-19 11:18 ` Duy Nguyen
@ 2016-03-21 16:22 ` David Turner
0 siblings, 0 replies; 5+ messages in thread
From: David Turner @ 2016-03-21 16:22 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Git Mailing List
On Sat, 2016-03-19 at 18:18 +0700, Duy Nguyen wrote:
> On Sat, Mar 19, 2016 at 8:19 AM, David Turner <
> dturner@twopensource.com> wrote:
> > Each write() has syscall overhead, and writing a large index
> > entails
> > many such calls. A larger write buffer reduces the overhead,
> > leading to increased performance.
> >
> > On my repo, which has an index size of 30m, this saves about 10ms
> > of
> > time writing the index.
>
> I wonder if split-index does not work as intended. Because if it
> does,
> you should rarely need to write that such big index files (or is this
> 30mb the small part and the base index is even bigger?).
>
> But I agree with Torsten that we should make this configurable,
> preferably via config file, if not we can still move this define back
> in Makefile, overridable using config.mak
Oh, right, split index. Yeah, I should just turn that on. Nevermind.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-21 16:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-19 1:19 [PATCH] read-cache: increase write buffer size David Turner
2016-03-19 8:05 ` Torsten Bögershausen
2016-03-19 10:25 ` Pranit Bauva
2016-03-19 11:18 ` Duy Nguyen
2016-03-21 16:22 ` David Turner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).