summaryrefslogtreecommitdiffstats
path: root/jack-tests
diff options
context:
space:
mode:
authorPiotr Jastrzebski <haaawk@google.com>2015-03-04 15:48:43 +0000
committerPiotr Jastrzebski <haaawk@google.com>2015-03-19 11:48:22 +0000
commit29d9d54dc51c57ce81773a9377449700f90556df (patch)
tree49ea0d891195a24bfebd5ed74872677cf1389640 /jack-tests
parent3a2129db18d560fd1412d9736cf3dfe7873236c6 (diff)
downloadtoolchain_jack-29d9d54dc51c57ce81773a9377449700f90556df.zip
toolchain_jack-29d9d54dc51c57ce81773a9377449700f90556df.tar.gz
toolchain_jack-29d9d54dc51c57ce81773a9377449700f90556df.tar.bz2
Stop creating message in NonSuchFileException unnecessarily
NoSuchFileException is thrown 29686 times during compilation of Music app but its message is not obtained even once. location.getDescription is not a cheap operation and message creation uses string concatenation as well. Instead of creating a message eagerily this change stores a reference to a location in the NonSuchFileExpection object and creates the message only when it's needed. This speeds up the creation of NoSuchFileException almost 40 times which makes a difference if we multiply it by almost 30k times it's created. We will also save on GC as it saves at least 3 object creations per NoSuchFileException which makes over 90k object creations saved. Fix also other exceptions in com.android.sched.util.file. Change-Id: Ibc2a413891a2e24be786f440196e9a4276215cc0
Diffstat (limited to 'jack-tests')
-rw-r--r--jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java b/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
index 8570382..9a6649c 100644
--- a/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
+++ b/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
@@ -115,9 +115,9 @@ public class DependenciesTest009 {
reader = new InputStreamReader(typeDependenciesVFile.openRead());
typeDependencies.read(reader);
} catch (NoSuchElementException e) {
- throw new CannotReadException(typeDependenciesVFile.getLocation(), e);
+ throw new CannotReadException(typeDependenciesVFile, e);
} catch (IOException e) {
- throw new CannotReadException(typeDependenciesVFile.getLocation(), e);
+ throw new CannotReadException(typeDependenciesVFile, e);
} finally {
if (reader != null) {
try {