git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB
@ 2013-02-14 13:34 Nguyễn Thái Ngọc Duy
  2013-02-19 10:45 ` Thomas Ackermann
  0 siblings, 1 reply; 4+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-02-14 13:34 UTC (permalink / raw
  To: git; +Cc: Nguyễn Thái Ngọc Duy

I just realized that many of my big repos are still on index v2 while
v4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6
and 25M -> 14M for webkit, for example). I wanted to propose index v4
as the new default version, because I guess that not many people
outside git@vger are aware of it, but perhaps this approach is less
drastic. It only suggest index v4 when the index size after clone hits
512K limit.

I have 170 git repositories (most of them Gnome projects) and only big
ones exceed the limit: webkit, linux-2.6, libreoffice-core, wine
(530K), gentoo-x86. Gimp and banshee are close (510K and 321K). The
rest barely hits 256K. So this hint won't show up often. On second
thought, maybe we should lower it down to 300K to show more often and
raise awareness on index v4 :)

Something I should have done in this patch too, is state that index v4
is only supported since vXXX, that git clients older than that will
not work. But maybe just put that in update-index man page and refer
there.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/clone.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/builtin/clone.c b/builtin/clone.c
index e0aaf13..7cd1b60 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -543,6 +543,7 @@ static int checkout(void)
 	struct tree *tree;
 	struct tree_desc t;
 	int err = 0, fd;
+	struct stat st;
 
 	if (option_no_checkout)
 		return 0;
@@ -591,6 +592,15 @@ static int checkout(void)
 	if (!err && option_recursive)
 		err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
 
+	if (!err &&
+	    !stat(git_path("index"), &st) &&
+	    st.st_size > 512 * 1024)
+		advise(_("Your index is quite large (%d KiB).\n"
+			 "You may want to update to index version 4 to reduce its size,\n"
+			"as large index files may affect performance, using the command:\n"
+			 "  git update-index --index-version 4"),
+		       st.st_size / 1024);
+
 	return err;
 }
 
-- 
1.8.1.2.536.gf441e6d

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB
  2013-02-14 13:34 [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB Nguyễn Thái Ngọc Duy
@ 2013-02-19 10:45 ` Thomas Ackermann
  2013-02-19 10:54   ` Duy Nguyen
  2013-02-19 18:59   ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Ackermann @ 2013-02-19 10:45 UTC (permalink / raw
  To: git

Nguyễn Thái Ngọc Duy <pclouds <at> gmail.com> writes:

> 
> I just realized that many of my big repos are still on index v2 while
> v4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6
> and 25M -> 14M for webkit, for example). I wanted to propose index v4
> as the new default version, because I guess that not many people
> outside git <at> vger are aware of it, but perhaps this approach is less
> drastic. It only suggest index v4 when the index size after clone hits
> 512K limit.
> 

Is V4 really recommended for general use?
Default seems to be V3 and all I found in the docs is
the coresponding release not describing V4 as "experimental".
(I have repos with index files > 40MiB (!) which will shrink to
approx. 20MiB with V4 so using V4 would be an interessting option for me.)

---
Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB
  2013-02-19 10:45 ` Thomas Ackermann
@ 2013-02-19 10:54   ` Duy Nguyen
  2013-02-19 18:59   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Duy Nguyen @ 2013-02-19 10:54 UTC (permalink / raw
  To: Thomas Ackermann; +Cc: git, Junio C Hamano

On Tue, Feb 19, 2013 at 5:45 PM, Thomas Ackermann <th.acker@arcor.de> wrote:
> Nguyễn Thái Ngọc Duy <pclouds <at> gmail.com> writes:
>
>>
>> I just realized that many of my big repos are still on index v2 while
>> v4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6
>> and 25M -> 14M for webkit, for example). I wanted to propose index v4
>> as the new default version, because I guess that not many people
>> outside git <at> vger are aware of it, but perhaps this approach is less
>> drastic. It only suggest index v4 when the index size after clone hits
>> 512K limit.
>>
>
> Is V4 really recommended for general use?
> Default seems to be V3 and all I found in the docs is
> the coresponding release not describing V4 as "experimental".
> (I have repos with index files > 40MiB (!) which will shrink to
> approx. 20MiB with V4 so using V4 would be an interessting option for me.)

The default could be either v2 or v3, depending on whether you use
some extra features. v4 is basically v3 with pathname compression.
Yes, I think it's ok for general use.
-- 
Duy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB
  2013-02-19 10:45 ` Thomas Ackermann
  2013-02-19 10:54   ` Duy Nguyen
@ 2013-02-19 18:59   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2013-02-19 18:59 UTC (permalink / raw
  To: Thomas Ackermann; +Cc: git

Thomas Ackermann <th.acker@arcor.de> writes:

> Is V4 really recommended for general use?

If you stick to C-git, I do not think there is any reason to avoid
it.  It is already a mature technology, the difference between 2 and
4 are so trivial that it is very unlikely for a latent bug to be
hiding in corner cases.

It is a different matter if various reimplementations already
support the format.  You can try it out, and if you find that other
tools based on reimplementations of Git you use do not understand
the format, you can safely go back with

	git update-index --index-version 2

after you upgraded to version 4.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-19 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 13:34 [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB Nguyễn Thái Ngọc Duy
2013-02-19 10:45 ` Thomas Ackermann
2013-02-19 10:54   ` Duy Nguyen
2013-02-19 18:59   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).