diff options
author | 2017-04-24 17:41:23 +0200 | |
---|---|---|
committer | 2017-04-24 18:00:38 +0200 | |
commit | aac13242c1e2bb6d1870e1284795bd3ca370984c (patch) | |
tree | f0cbeda6d8806f2d0560f9941da7fb52ce95dc80 /src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java | |
parent | 3d596d63f883fff56001ed7b2e5cf51dba45f082 (diff) |
Make PathFragment an abstract class.
There are now four concrete implementations: RelativeUnixPathFragment, AbsoluteUnixPathFragment, RelativeWindowsPathFragment, AbsoluteWindowsPathFragment.
Goals:
-Reduce memory usage of PathFragment on non-Windows platforms while maintaining existing semantics.
-Make a few simple performance improvements along the way.
-Add TODOs for a few more simple performance improvements.
-Open the way for reducing code complexity of PathFragment. All of the Windows-specific stuff ought not complicate the code so much.
Non goals:
-Make the entire codebase as pretty as possible wrt PathFragment & Windows.
-Make PathFragment usage more sane in general (e.g. change semantics to ban coexistence of Windows and Unix PathFragments).
-Optimize PathFragment as much as possible wrt memory or even in any other dimensions (e.g. gc churn, cpu).
To elaborate, the primary motivation is per-instance memory usage of PathFragment on Unix platforms:
Before this change
------------------
+UseCompressedOops --> 32 bytes per instance
-UseCompressedOops --> 40 bytes per instance
After this change
------------------
+UseCompressedOops --> 24 bytes per instance
-UseCompressedOops --> 32 bytes per instance
Since Bazel can retain lots of PathFragments, the memory savings of this CL are fairly large.
RELNOTES: None
PiperOrigin-RevId: 154052905
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java index 2e455ccae8..4b84903601 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentTest.java @@ -73,7 +73,8 @@ public class PathFragmentTest { .addEqualityGroup( PathFragment.create("../relative/path"), PathFragment.create("..").getRelative("relative").getRelative("path"), - PathFragment.createNoClone('\0', false, new String[] {"..", "relative", "path"}), + PathFragment.createAlreadyInterned( + '\0', false, new String[] {"..", "relative", "path"}), PathFragment.create(new File("../relative/path"))) .addEqualityGroup(PathFragment.create("something/else")) .addEqualityGroup(PathFragment.create("/something/else")) |