aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2016-04-29 22:17:00 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-05-02 09:10:07 +0000
commitdd61520f48cb5fcc28df374e8f7c4c05f68f18a0 (patch)
treefe62e67b8d28e582879b2053920b7ddccc3fafd3 /src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java
parent19350de0caaafbe3c6800c09d520d3ced82d87f9 (diff)
When we don't have an OutputService, precompute and cache the assumed-to-be-immutable filesystem type of output_base.
When we do have an OutputService, defer computation of the OutputService's dynamic filesystem type until we actually need it at the start of a "build" or "test" command. This saves ~450us on each invocation, according to my benchmarks. -- MOS_MIGRATED_REVID=121156323
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java
index aa98d3b98a..6652bd74ab 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeWorkspace.java
@@ -69,6 +69,8 @@ public final class BlazeWorkspace {
@Nullable
private Range<Long> lastExecutionRange = null;
+ private final String outputBaseFilesystemTypeName;
+
public BlazeWorkspace(BlazeRuntime runtime, BlazeDirectories directories,
SkyframeExecutor skyframeExecutor, SubscriberExceptionHandler eventBusExceptionHandler,
WorkspaceStatusAction.Factory workspaceStatusActionFactory, BinTools binTools) {
@@ -85,6 +87,9 @@ public final class BlazeWorkspace {
writeDoNotBuildHereFile(runtime.getStartupOptionsProvider());
}
setupExecRoot();
+ // Here we use outputBase instead of outputPath because we need a file system to create the
+ // latter.
+ this.outputBaseFilesystemTypeName = FileSystemUtils.getFileSystem(getOutputBase());
}
/**
@@ -126,6 +131,15 @@ public final class BlazeWorkspace {
}
/**
+ * Returns the cached value of
+ * {@code getOutputBase().getFilesystem().getFileSystemType(getOutputBase())}, which is assumed
+ * to be constant for a fixed workspace for the life of the Blaze server.
+ */
+ public String getOutputBaseFilesystemTypeName() {
+ return outputBaseFilesystemTypeName;
+ }
+
+ /**
* Returns the output path associated with this Blaze server process..
*/
public Path getOutputPath() {