Re: Use File.isFile() instead of exists() && !isDirectory(). (issue 152123002)

20 views
Skip to first unread message

sche...@google.com

unread,
Feb 1, 2014, 6:05:24 AM2/1/14
to brianwi...@google.com, rev...@dartlang.org

sche...@google.com

unread,
Feb 1, 2014, 6:05:23 AM2/1/14
to brianwi...@google.com, rev...@dartlang.org
Reviewers: Brian Wilkerson,

Description:
Use File.isFile() instead of exists() && !isDirectory().

This is slightly faster, 5300 ms vs. 7200 + 3500.

R=brianwi...@google.com
BUG=

Please review this at https://codereview.chromium.org/152123002/

SVN Base: https://dart.googlecode.com/svn/branches/bleeding_edge/dart

Affected files (+1, -1 lines):

editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java


Index:
editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java
diff --git
a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java
b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java
index
318a6e7ec4de97fda2dcbca2cbb85db027c77e71..4f3148ca6a4f4290271e7992c7d0bac075b38439
100644
---
a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java
+++
b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/source/FileBasedSource.java
@@ -90,7 +90,7 @@ public class FileBasedSource implements Source {

@Override
public boolean exists() {
- return contentCache.getContents(this) != null || (file.exists()
&& !file.isDirectory());
+ return contentCache.getContents(this) != null || file.isFile();
}

@Override


sche...@google.com

unread,
Feb 1, 2014, 6:05:26 AM2/1/14
to brianwi...@google.com, rev...@dartlang.org

sche...@google.com

unread,
Feb 1, 2014, 6:05:25 AM2/1/14
to brianwi...@google.com, rev...@dartlang.org
Reply all
Reply to author
Forward
0 new messages