Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Issue 1455003002: Optimize absolute() and normalize(). (Closed)

Created:
5 years, 1 month ago by nweiz
Modified:
5 years, 1 month ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/path@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Optimize absolute() and normalize(). This short-circuits absolute() if the path is already absolute. Detecting absolute paths is very fast, whereas join() is relatively slow. For normalize(), this runs a single-pass check over a path to see whether it needs to be normalized at all. This check isn't free, but it's a lot less costly than parsing and reserializing the path, and it covers the common case. See dart-lang/glob#24962 R=rnystrom@google.com Committed: https://github.com/dart-lang/path/commit/9bad3dea80a64143e0354b4d06ce535b3945d801

Patch Set 1 #

Total comments: 2

Patch Set 2 : Code review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -1 line) Patch
M CHANGELOG.md View 1 chunk +4 lines, -0 lines 0 comments Download
M benchmark/benchmark.dart View 1 chunk +1 line, -0 lines 0 comments Download
M lib/src/context.dart View 1 3 chunks +78 lines, -0 lines 0 comments Download
M pubspec.yaml View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
nweiz
5 years, 1 month ago (2015-11-17 23:47:11 UTC) #1
Bob Nystrom
One suggestion then LGTM! https://codereview.chromium.org/1455003002/diff/1/lib/src/context.dart File lib/src/context.dart (right): https://codereview.chromium.org/1455003002/diff/1/lib/src/context.dart#newcode82 lib/src/context.dart:82: if (isAbsolute(part1) && !isRootRelative(part1) && ...
5 years, 1 month ago (2015-11-17 23:55:10 UTC) #2
nweiz
Code review changes
5 years, 1 month ago (2015-11-18 00:03:52 UTC) #3
nweiz
Committed patchset #2 (id:20001) manually as 9bad3dea80a64143e0354b4d06ce535b3945d801 (presubmit successful).
5 years, 1 month ago (2015-11-18 00:04:01 UTC) #4
nweiz
5 years, 1 month ago (2015-11-18 00:04:14 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/1455003002/diff/1/lib/src/context.dart
File lib/src/context.dart (right):

https://codereview.chromium.org/1455003002/diff/1/lib/src/context.dart#newcode82
lib/src/context.dart:82: if (isAbsolute(part1) && !isRootRelative(part1) &&
part2 == null) {
On 2015/11/17 23:55:10, Bob Nystrom wrote:
> I'd move the null check first since that will be the fastest.

Done.

Powered by Google App Engine
This is Rietveld 408576698