aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.benchmarks
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-06-10 10:14:28 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2020-06-10 10:33:50 +0200
commit4887894ffd637030a311ca8d60b78515b1a5cf35 (patch)
treea890edb80b54f5c5078a10b938b37f04ee12edca /org.eclipse.jgit.benchmarks
parent629fa260c03a54cac35836010df34b565d13fe85 (diff)
parent0ec6e4b3d5becf0025dcf83e8b843c9c34043ba0 (diff)
downloadjgit-4887894ffd637030a311ca8d60b78515b1a5cf35.tar.gz
jgit-4887894ffd637030a311ca8d60b78515b1a5cf35.zip
Merge branch 'master' into next
* master: SimpleMergeTest: Clean up code style Prepare 5.8.1-SNAPSHOT builds Handle Fragment-Host declaration when updating version JGit v5.8.0.202006091008-r Prepare 5.9.0-SNAPSHOT builds Handle Fragment-Host declaration when updating version Add benchmark for strategies how to move a file Add getter for unpackErrorHandler in ReceivePack Upgrade maven-project-info-reports-plugin to 3.1.0 Upgrade maven-shade-plugin to 3.2.4 ObjectDirectoryInserter: Open FileOutputStream in try-with-resource ObjectDirectoryInserter: Remove redundant 'throws' declarations ObjectDirectory: Further clean up insertUnpackedObject Add Git#shutdown for releasing resources held by JGit process ApplyCommand: use context lines to determine hunk location GPG: don't prompt for a passphrase for unprotected keys Fix typo in org.eclipse.jgit.ssh.jsch.test MANIFEST Fix ProtectedMembersInFinalClass warning flagged by error prone Use version range to define fragment host bundle version ObjectDirectory: Explicitly handle NoSuchFileException ObjectDirectory: Fail immediately when atomic move is not supported Fix jgit packaging Fix InvalidInlineTag error flagged by error prone Fix BadComparable error flagged by error prone Add tests for RawTextComparator.WS_IGNORE_CHANGE.hash() Update Orbit to R20200529191137 for final Eclipse release 2020-06 Organize manifest of org.eclipse.jgit.pgm Do not include log4j implementation in jgit Decouple JSch from JGit Core Decouple BouncyCastle from JGit Core Verify that the user home directory is valid WindowCache: conditional JMX setup RawTextComparator.WS_IGNORE_CHANGE must not compare whitespace Revert "PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex" Update jetty to 9.4.28.v20200408 Add 4.16 staging target platform In-memory SSH keys for the "no files" sshd tests Builder API to configure SshdSessionFactories TransportHttp: abort on time-out or on SocketException Ignore core.eol if core.autocrlf=input Attributes: fix handling of text=auto in combination with eol Bazel: Remove superfluous dependencies flagged by unused_deps Log stack trace if CachingKeyPairProvider hits unexpected exception Update Orbit to S20200519202422 and ant to 1.10.8 Include full IssuerFingerprint in GPG signature Bazel: Fix src_sha1 of bcpg-jdk15on Suppress API error for new method BitmapIndex.Bitmap#retrieveCompressed Fix wrong @since tags added in dcb0265 PackBitmapIndex: Set distance threshold PackBitmapIndex: Not buffer inflated bitmap in BasePackBitmapIndex PackBitmapIndex: Remove convertedBitmaps in the Remapper PackBitmapIndex: Reduce memory usage in GC PackBitmapIndex: Add AddToBitmapWithCacheFilter class PackBitmapIndex: Add util methods and builder to BitmapCommit PackBitmapIndex: Move BitmapCommit to a top-level class Refactor: Make retriveCompressed an method of the Bitmap class Fix downloading LFS Object fails behind proxy Allow for using custom s3 host with lfs server ReceivePack: adding IterativeConnectivityChecker Moving transport/internal -> internal/transport Fix error occurring during checkout Change-Id: Ic11286e16ed6a72c6372297b310336dd040689d1
Diffstat (limited to 'org.eclipse.jgit.benchmarks')
-rw-r--r--org.eclipse.jgit.benchmarks/src/org/eclipse/jgit/benchmarks/FileMoveBenchmark.java136
1 files changed, 136 insertions, 0 deletions
diff --git a/org.eclipse.jgit.benchmarks/src/org/eclipse/jgit/benchmarks/FileMoveBenchmark.java b/org.eclipse.jgit.benchmarks/src/org/eclipse/jgit/benchmarks/FileMoveBenchmark.java
new file mode 100644
index 0000000000..d3ada22df2
--- /dev/null
+++ b/org.eclipse.jgit.benchmarks/src/org/eclipse/jgit/benchmarks/FileMoveBenchmark.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2020, Matthias Sohn <matthias.sohn@sap.com> and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * https://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.benchmarks;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.jgit.util.FileUtils;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+@State(Scope.Thread)
+public class FileMoveBenchmark {
+ int i;
+
+ Path testDir;
+
+ Path targetDir;
+
+ @Setup
+ public void setupBenchmark() throws IOException {
+ testDir = Files.createTempDirectory("dir");
+ targetDir = testDir.resolve("target");
+ Files.createDirectory(targetDir);
+ }
+
+ @TearDown
+ public void teardown() throws IOException {
+ FileUtils.delete(testDir.toFile(),
+ FileUtils.RECURSIVE | FileUtils.RETRY);
+ }
+
+ @Benchmark
+ @BenchmarkMode({ Mode.AverageTime })
+ @OutputTimeUnit(TimeUnit.MICROSECONDS)
+ @Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
+ @Measurement(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
+ public Path moveFileToExistingDir() throws IOException {
+ i++;
+ Path tmp = testDir.resolve("tmp" + i++);
+ Files.createFile(tmp);
+ Path targetDirectory = targetDir;
+ Path targetFile = targetDirectory.resolve("tmp" + i);
+ try {
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ } catch (NoSuchFileException e) {
+ Files.createDirectory(targetDirectory);
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ }
+ }
+
+ @Benchmark
+ @BenchmarkMode({ Mode.AverageTime })
+ @OutputTimeUnit(TimeUnit.MICROSECONDS)
+ @Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
+ @Measurement(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
+ public Path moveFileToExistingDirExists() throws IOException {
+ Path tmp = testDir.resolve("tmp" + i++);
+ Files.createFile(tmp);
+ Path targetDirectory = targetDir;
+ Path targetFile = targetDir.resolve("tmp" + i);
+ if (!targetDirectory.toFile().exists()) {
+ Files.createDirectory(targetDirectory);
+ }
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ }
+
+ @Benchmark
+ @BenchmarkMode({ Mode.AverageTime })
+ @OutputTimeUnit(TimeUnit.MICROSECONDS)
+ @Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
+ @Measurement(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
+ public Path moveFileToMissingDir() throws IOException {
+ i++;
+ Path tmp = testDir.resolve("tmp" + i);
+ Files.createFile(tmp);
+ Path targetDirectory = testDir.resolve("target" + i);
+ Path targetFile = targetDirectory.resolve("tmp" + i);
+ try {
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ } catch (NoSuchFileException e) {
+ Files.createDirectory(targetDirectory);
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ }
+ }
+
+ @Benchmark
+ @BenchmarkMode({ Mode.AverageTime })
+ @OutputTimeUnit(TimeUnit.MICROSECONDS)
+ @Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
+ @Measurement(iterations = 5, time = 5000, timeUnit = TimeUnit.MILLISECONDS)
+ public Path moveFileToMissingDirExists() throws IOException {
+ i++;
+ Path tmp = testDir.resolve("tmp" + i);
+ Files.createFile(tmp);
+ Path targetDirectory = testDir.resolve("target" + i);
+ Path targetFile = targetDirectory.resolve("tmp" + i);
+ if (!targetDirectory.toFile().exists()) {
+ Files.createDirectory(targetDirectory);
+ }
+ return Files.move(tmp, targetFile, StandardCopyOption.ATOMIC_MOVE);
+ }
+
+ public static void main(String[] args) throws RunnerException {
+ Options opt = new OptionsBuilder()
+ .include(FileMoveBenchmark.class
+ .getSimpleName())
+ // .addProfiler(StackProfiler.class)
+ // .addProfiler(GCProfiler.class)
+ .forks(1).jvmArgs("-ea").build();
+ new Runner(opt).run();
+ }
+} \ No newline at end of file