jgit/org.eclipse.jgit.test
Dariusz Luksza 4f18c50950 Optimize RefDirectory.getRefsByPrefix(String...)
Currently for file-based repositories JGit will go over all refs in the
repository forach `ref-prefix` listed in the `ls-refs` command in git
protocol v2 request.

Native git, uses a different approach, where all refs are read once and
then for each ref, all `ref-prefix` filter values are checked in one
pass.

This change implements this approach in JGit only in the `RefDirectory`
backend. And makes `ref-prefix` filtering ~40% faster for repositories
with packed refs.

Different implementations were tested on a synthetic file repository
with 10k refs in `refs/heads/` and `290k` in `refs/changes`. Before
testing `git pack-refs` command was executed. All results are in
seconds.

Current Impl:               39.340   37.093   35.996
Nested for loops:           25.077   24.742   24.748
Nested streams:             24.827   24.890   27.525
Parallel stream + stream:   23.357   23.318   23.174
Nested parallel streams:    23.490   23.318   23.317
Stream + for loop:          23.147   23.210   23.126
Parallel stream + for loop: 23.317   23.423   22.847

The elapsed time was measured around `getRefByPrefix` call in
`Uploadapack.getFilteredRefs(Collection<String>)` (around lines 952 and
954). For testing a modified version of
`UploadPackTest.testV2LsRefsRefPrefix()` was used. The modifications
here included:
  * shadowing protected `repo` variable with `FileRepository` pointing
    to the synthetic repo with 300k refs described above,
  * mimicking the git client clone request by adding `ref-prefix HEAD`,
    `ref-prefix refs/heads/` and `ref-prefix refs/tags/`

Based on the above results, the implementation with parallel stream and
stream was selected.

Bug: 578550
Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com>
Change-Id: I6416846c074b611ff6ec9d351dbafcfbcaf68e66
2023-11-12 13:31:16 +01:00
..
.settings Merge branch 'stable-5.5' into stable-5.6 2021-12-04 18:06:32 +01:00
META-INF Prepare 6.8.0-SNAPSHOT builds 2023-09-07 02:24:53 +02:00
exttst/org/eclipse/jgit Add a cgit interoperability test for LockFile 2021-05-09 22:49:19 +02:00
findBugs [spotbugs] Silence CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE in jgit tests 2020-12-22 10:53:00 +01:00
src/org/eclipse/jgit Decouple JSch from JGit Core 2020-06-01 01:46:59 +02:00
tst/org/eclipse/jgit Optimize RefDirectory.getRefsByPrefix(String...) 2023-11-12 13:31:16 +01:00
tst-rsrc Merge branch 'stable-6.6' into stable-6.7 2023-09-03 02:16:04 +02:00
.classpath Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
.gitignore Fix test setup for Eclipse Photon and greater 2018-11-02 18:50:26 +01:00
.project
BUILD CommitGraphWriter: write changed-path filters 2023-07-18 14:21:48 -07:00
build.properties Update slf4j to 1.7.36 and consume it directly from Maven Central 2023-05-02 17:05:18 +02:00
org.eclipse.jgit.core--All-Tests (Java 11) (de).launch Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
org.eclipse.jgit.core--All-Tests (Java 11).launch Bump minimum required Java version to 11 2021-09-29 17:12:12 +02:00
org.eclipse.jgit.core--All-Tests.launch
org.eclipse.jgit.test-WalkEncryptionTest-Proxy.launch
org.eclipse.jgit.test-WalkEncryptionTest.launch
plugin.properties Fix bundle localization of Apache SSH bundle 2019-06-21 17:54:06 +02:00
pom.xml Update mockito to 5.7.0 and bytebuddy to 1.14.9 2023-11-09 00:08:42 +01:00
tests.bzl Fix after_open config and Snapshotting RefDir tests to work with bazel 2023-04-26 22:01:05 +02:00