Skip to contentSkip to conversation

(unknown)

PATCH Superseded David Turner 2 participants 4 messages Jun 15, 2016

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

This version changes only the commit message; there is no longer any configure.ac code.

#1 lore raw

PATCH v10 1/1 refs.c: SSE2 optimizations for check_refname_component

Optimize check_refname_component using SSE2 on x86_64.

git rev-parse HEAD is a good test-case for this, since it does almost nothing except parse refs. For one particular repo with about 60k refs, almost all packed, the timings are:

Look up table: 29 ms
SSE2:          23 ms

This cuts about 20% off of the runtime.

Ondřej Bílka <[email protected]> suggested an SSE2 approach to the substring searches, which netted a speed boost over the SSE4.2 code I had initially written.

---
 git-compat-util.h  |  11 +++
 refs.c             | 223 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 t/t5511-refspec.sh |  20 +++++
 3 files changed, 236 insertions(+), 18 deletions(-)
git-compat-util.h +11 -0
index f6d3a46..0aec58e 100644
@@ -668,6 +668,17 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #endif
 #endif
 
+#if defined(__GNUC__) && defined(__x86_64__)
+#include <emmintrin.h>
+/*
+ * This is the system memory page size; it's used so that we can read
+ * outside the bounds of an allocation without segfaulting.
+ */
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+#endif
+
 #ifdef UNRELIABLE_FSTAT
 #define fstat_is_reliable() 0
 #else
refs.c +205 -18

270 lines not on this page · raw message

t/t5511-refspec.sh +20 -0
index de6db86..51d23b1 100755
@@ -29,6 +29,10 @@ test_refspec push '+:'
 test_refspec fetch ''
 test_refspec fetch ':'
 test_refspec fetch '::'						invalid
+test_refspec fetch '.'						invalid
+test_refspec fetch './frotz'					invalid
+test_refspec fetch 'refs/.'					invalid
+test_refspec push '*//:refs/remotes/frotz/*'			invalid
 
 test_refspec push 'refs/heads/*:refs/remotes/frotz/*'
 test_refspec push 'refs/heads/*:refs/remotes/frotz'		invalid
@@ -71,6 +75,9 @@ test_refspec fetch ':refs/remotes/frotz/HEAD-to-me'
 test_refspec push ':refs/remotes/frotz/delete me'		invalid
 test_refspec fetch ':refs/remotes/frotz/HEAD to me'		invalid
 
+test_refspec fetch ':refs/remotes/frotz/something.lock'		invalid
+test_refspec fetch ':refs/remotes/frotz/a.lock/b'		invalid
+
 test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' invalid
 test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' invalid
 
@@ -88,4 +95,17 @@ test_refspec fetch "refs/heads/${good}"
 bad=$(printf '\011tab')
 test_refspec fetch "refs/heads/${bad}"				invalid
 
+test_refspec fetch 'refs/heads/a-very-long-refname'
+test_refspec fetch 'refs/heads/.a-very-long-refname'		invalid
+test_refspec fetch 'refs/heads/abcdefgh0123..'			invalid
+test_refspec fetch 'refs/heads/abcdefgh01234..'			invalid
+test_refspec fetch 'refs/heads/abcdefgh012345..'		invalid
+test_refspec fetch 'refs/heads/abcdefgh0123456..'		invalid
+test_refspec fetch 'refs/heads/abcdefgh01234567..'		invalid
+test_refspec fetch 'refs/heads/abcdefgh0123.a'
+test_refspec fetch 'refs/heads/abcdefgh01234.a'
+test_refspec fetch 'refs/heads/abcdefgh012345.a'
+test_refspec fetch 'refs/heads/abcdefgh0123456.a'
+test_refspec fetch 'refs/heads/abcdefgh01234567.a'
+
 test_done
Signature · 1 line
2.0.0.rc1.24.g0588c94.dirty
#2 lore raw

Re: [PATCH v10 1/1] refs.c: SSE2 optimizations for check_refname_component

Quoted 9 lines · David Turner

Optimize check_refname_component using SSE2 on x86_64.

git rev-parse HEAD is a good test-case for this, since it does almost nothing except parse refs. For one particular repo with about 60k refs, almost all packed, the timings are:

Look up table: 29 ms
SSE2:          23 ms
Quoted 8 lines

This cuts about 20% off of the runtime.

Ondřej Bílka <[email protected]> suggested an SSE2 approach to the substring searches, which netted a speed boost over the SSE4.2 code I had initially written.

---

When applied on top of your dde8a902 (refs.c: optimize check_refname_component(), 2014-06-03), this seems to fail t1402 for me.

Test Summary Report
-------------------
t1402-check-ref-format.sh (Wstat: 256 Tests: 93 Failed: 9)
Failed tests: 28, 36, 38, 40, 63, 75, 77, 85-86 Non-zero exit status: 1

#28 is the one that runs "check-ref-format heads/v@{ation".

#3 lore raw

Re: [PATCH v10 1/1] refs.c: SSE2 optimizations for check_refname_component

Quoted 24 lines · Junio C Hamano
Quoted 9 lines · David Turner

Optimize check_refname_component using SSE2 on x86_64.

git rev-parse HEAD is a good test-case for this, since it does almost nothing except parse refs. For one particular repo with about 60k refs, almost all packed, the timings are:

Look up table: 29 ms
SSE2:          23 ms
Quoted 8 lines

This cuts about 20% off of the runtime.

Ondřej Bílka <[email protected]> suggested an SSE2 approach to the substring searches, which netted a speed boost over the SSE4.2 code I had initially written.

---

When applied on top of your dde8a902 (refs.c: optimize check_refname_component(), 2014-06-03), this seems to fail t1402 for me.

Quoted 7 lines

Test Summary Report
-------------------
t1402-check-ref-format.sh (Wstat: 256 Tests: 93 Failed: 9)
Failed tests: 28, 36, 38, 40, 63, 75, 77, 85-86 Non-zero exit status: 1

#28 is the one that runs "check-ref-format heads/v@{ation".

Oops, I didn't even notice that test! I was looking only at t5511! Will fix.