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

Issue 1418483008: Optimize splitting lines with many rules. (Closed)

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

Description

Optimize splitting lines with many rules. The constraint checking was quadratic in the number of rules in the line which is bad on pathologically long lines like #456. This gets it back down to linear. It takes that bug from 7 minutes to about 20 seconds on my machine. The benchmark, which is closer to real code, gets about 20% faster. I'm still leaving #456 open because I think there's more work to be done there, but this is a solid improvement overall. R=kevmoo@google.com Committed: https://github.com/dart-lang/dart_style/commit/10ad66e2915f8760aa0c07fac47f2fd7474b2b88

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+106 lines, -39 lines) Patch
M CHANGELOG.md View 1 chunk +1 line, -0 lines 0 comments Download
M lib/src/chunk.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M lib/src/debug.dart View 1 chunk +4 lines, -2 lines 0 comments Download
M lib/src/line_splitting/line_splitter.dart View 1 chunk +6 lines, -0 lines 0 comments Download
M lib/src/line_splitting/rule_set.dart View 1 chunk +1 line, -3 lines 0 comments Download
M lib/src/line_splitting/solve_state.dart View 6 chunks +40 lines, -15 lines 4 comments Download
M lib/src/rule/argument.dart View 4 chunks +17 lines, -15 lines 0 comments Download
M lib/src/rule/rule.dart View 2 chunks +35 lines, -2 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
Bob Nystrom
5 years, 1 month ago (2015-11-09 23:03:17 UTC) #2
kevmoo
LGTM w/ a question Also: self-format – I saw a weird update to lib/src/dart_formatter.dart – ...
5 years, 1 month ago (2015-11-09 23:40:47 UTC) #3
Bob Nystrom
Committed patchset #1 (id:1) manually as 10ad66e2915f8760aa0c07fac47f2fd7474b2b88 (presubmit successful).
5 years, 1 month ago (2015-11-10 20:08:05 UTC) #4
Bob Nystrom
5 years, 1 month ago (2015-11-10 20:08:24 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/1418483008/diff/1/lib/src/line_splitting/solv...
File lib/src/line_splitting/solve_state.dart (right):

https://codereview.chromium.org/1418483008/diff/1/lib/src/line_splitting/solv...
lib/src/line_splitting/solve_state.dart:504: _constraints = {};
On 2015/11/09 23:40:46, kevmoo wrote:
> QQ: does order matter here? Would using HashMap from dart:collection improve
> perf?

Nope. No measurable improvement.

https://codereview.chromium.org/1418483008/diff/1/lib/src/line_splitting/solv...
lib/src/line_splitting/solve_state.dart:531: _unboundConstraints = {};
On 2015/11/09 23:40:46, kevmoo wrote:
> ditto RE HashMap

Acknowledged.

Powered by Google App Engine
This is Rietveld 408576698