summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.benchmarks/src
Commit message (Collapse)AuthorAgeFilesLines
* Introduce a PriorityQueue sorting RevCommits by commit timestampLuca Milanesio2024-01-191-0/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DateRevQueue uses a tailor-made algorithm to keep RevCommits sorted by reversed commit timestamp, which has a O(n*n/2) complexity and caused the explosion of the Git fetch times to tens of seconds. The standard Java PriorityQueue provides a O(n*log(n)) complexity and scales much better with the increase of the number of RevCommits. Introduce a new implementation DateRevPriorityQueue of the DateRevQueue based on PriorityQueue. Enable usage of the new DateRevPriorityQueue implementation by setting the system property REVWALK_USE_PRIORITY_QUEUE=true. By default the old implementation DateRevQueue is used. Benchmark results: ``` (numCommits) (usePriorityQueue) Mode Cnt Score Error Units 5 true avgt 10 39,4 ± 6,1 ns/op 5 false avgt 10 14,1 ± 2,2 ns/op 10 true avgt 10 29,7 ± 3,5 ns/op 10 false avgt 10 13,2 ± 2,0 ns/op 50 true avgt 10 50,4 ± 5,3 ns/op 50 false avgt 10 18,6 ± 0,2 ns/op 100 true avgt 10 58,3 ± 5,0 ns/op 100 false avgt 10 20,5 ± 0,8 ns/op 500 true avgt 10 51,7 ± 2,6 ns/op 500 false avgt 10 43,3 ± 0,5 ns/op 1000 true avgt 10 49,2 ± 2,4 ns/op 1000 false avgt 10 62,7 ± 0,2 ns/op 5000 true avgt 10 48,8 ± 1,5 ns/op 5000 false avgt 10 228,3 ± 0,5 ns/op 10000 true avgt 10 44,2 ± 0,9 ns/op 10000 false avgt 10 377,6 ± 2,7 ns/op 50000 true avgt 10 50,3 ± 1,6 ns/op 50000 false avgt 10 637,0 ± 111,8 ns/op 100000 true avgt 10 61,8 ± 4,4 ns/op 100000 false avgt 10 965,1 ± 268,0 ns/op 500000 true avgt 10 127,2 ± 7,9 ns/op 500000 false avgt 10 9610,2 ± 184,8 ns/op ``` Memory allocation results: ``` Number of commits loaded: 850 000 Custom implementation: 378 245 120 Bytes Priority queue implementation: 340 495 616 Bytes ``` Bug: 580137 Change-Id: I8b33df6e9ee88933098ecc81ce32bdb189715041 Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
* Remove unused importsMatthias Sohn2022-11-202-8/+10
| | | | Change-Id: I57a3ae0a8608a517d9cc5cc27cee136f9faeb810
* Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2022-11-165-8/+99
|\ | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: [benchmarks] Remove profiler configuration Add SHA1 benchmark [benchmarks] Set version of maven-compiler-plugin to 3.8.1 Fix running JMH benchmarks Add option to allow using JDK's SHA1 implementation Ignore IllegalStateException if JVM is already shutting down Change-Id: Ie433c46a01a0f33848d54ecf99b30a44ca01e286
| * [benchmarks] Remove profiler configurationMatthias Sohn2022-11-154-8/+0
| | | | | | | | | | | | | | Profiler configuration can be added when required. It was commented out in most benchmarks. Change-Id: I725f98757f7d4d2ba2589658e34e2fd6fbbbedee
| * Add SHA1 benchmarkMatthias Sohn2022-11-151-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results on a Mac M1 max: size SHA1Native SHA1Java SHA1Java without with collision collision detection detection [kB] [us/op] [us/op] [us/op] --------------------------------------------- 1 3.662 4.200 4.707 2 7.053 7.868 8.928 4 13.883 15.149 17.608 8 27.225 30.049 35.237 16 54.014 59.655 70.867 32 106.457 118.022 140.403 64 212.712 237.702 281.522 1024 3469.519 3868.883 4637.287 131072 445011.724 501751.992 604061.308 1048576 3581702.104 4008087.854 4831023.563 The last 3 sizes (1, 128, 1024 MB) weren't committed here to limit the total runtime. Bug: 580310 Change-Id: I7d0382fd4aa4c4734806b12e96b671bee37d26e3
* | Add GetRefsBenchmark for testing refs lookupsLuca Milanesio2022-04-011-0/+181
|/ | | | | | | | | | | | | | | | | | | | | Introduce a new benchmark that shows a typical use-case of opening a cached repository and fetching one ref from a repository with a high number of refs. This specific benchmark is tailored to the Gerrit use-case of reading frequently individual refs SHA1s and by ref-name prefix from the All-Users repository. Include the following variables for the benchmark: - numBranches (from 100 up to 50000) - trustFolderStat (true or false) - useRefTable (true or false) The benchmark needs to be evaluated on a local high-perf SSD and on a slower NFS network disk. Bug: 576165 Change-Id: Ie59a87ca9f0191ff30229688e3430332e2f59a4f
* Add benchmark for strategies how to move a fileMatthias Sohn2020-06-061-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | We can either - try moving the file and, in case the target directory doesn't exist, handle the NoSuchFileException this raises to create the target directory - or we always first test if the target directory exists and create it in case it is missing On my Mac this yields Benchmark Mode Cnt Score Error Units FileMoveBenchmark.moveFileToExistingDir avgt 5 196.490 ± 15.194 us/op FileMoveBenchmark.moveFileToExistingDirExists avgt 5 223.217 ± 54.816 us/op FileMoveBenchmark.moveFileToMissingDir avgt 5 332.169 ± 43.871 us/op FileMoveBenchmark.moveFileToMissingDirExists avgt 5 303.815 ± 137.568 us/op This means if the target directory of the move already exists the first strategy is faster by around 25 us/op otherwise the second one is faster by around 30 us/op. Which one is favorable depends on the average probability that the target directory exists in real world scenarios. Change-Id: I03653b408b859a796508dfa1471b36c65633534e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-043-114/+15
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unused import in CreateFileSnapshotBenchmarkMatthias Sohn2019-11-261-1/+0
| | | | Change-Id: Ic02f32fb882602e573f34d0a38d850f43aadf7ba Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Benchmark for creating files and FileSnapshotsMatthias Sohn2019-11-051-0/+111
| | | | Change-Id: I953fd8b6b9743b0b9cada244331253eb2121784d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement benchmark for looking up FileStore of a given PathMatthias Sohn2019-11-051-0/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results on Mac OS 10.14.6 using APFS: Result "org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore": 44583.277 ±(99.9%) 2666.096 ns/op [Average] (min, avg, max) = (43707.073, 44583.277, 45320.685), stdev = 692.377 CI (99.9%): [41917.181, 47249.373] (assumes normal distribution) Secondary result "org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore:·stack": Stack profiler: ....[Thread state distributions]........................................................ 100.0% RUNNABLE ....[Thread state: RUNNABLE]............................................................. 42.5% 42.5% sun.nio.fs.UnixNativeDispatcher.realpath0 37.9% 37.9% sun.nio.fs.UnixNativeDispatcher.stat0 11.0% 11.0% sun.nio.fs.BsdNativeDispatcher.getfsstat 7.6% 7.6% sun.nio.fs.BsdNativeDispatcher.fsstatEntry 0.7% 0.7% sun.nio.fs.BsdNativeDispatcher.endfsstat 0.1% 0.1% sun.nio.fs.UnixPath.initOffsets 0.0% 0.0% sun.nio.fs.UnixFileAttributes.get 0.0% 0.0% java.util.zip.Inflater.inflateBytes 0.0% 0.0% sun.misc.Unsafe.compareAndSwapInt 0.0% 0.0% sun.nio.fs.BsdFileStore.findMountEntry This shows that FS.attrCacheByPath should be useful to reduce overhead of looking up the FileStore of a given file. Change-Id: I7213086b42e0453f0ee149660d507dac2a4644cc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JMH benchmark for SimpleLruCacheMatthias Sohn2019-11-051-0/+112
See [1] for JMH documentation and [2] how to use JMH in Eclipse. The benchmarks pom currently cannot use the JGit parent pom due to an ecj bug [3] regarding annotation processing. Hence for now do not inherit from the JGit parent pom and copy the compiler plugin configuration for javac from the parent pom. After running the Maven build the benchmark can be run using Maven: $ java -jar org.eclipse.jgit.benchmarks/target/benchmarks.jar or in Eclipse by running the main method of the SimpleLruCacheBenchmark class. [1] https://openjdk.java.net/projects/code-tools/jmh/ [2] http://alblue.bandlem.com/Page/3/index.html [3] https://eclip.se/532029 CQ: 20517 CQ: 20518 Change-Id: Idca8a9e0980f0b8a9c741c4c9e97d03c62f07c8d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>