Skip to content

Commit aff322b

Browse files
authored
Misc performance tweaks (#1430)
* performance tweaks * cleanup and change mustache version to remote again
1 parent 385bfa9 commit aff322b

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

lib/dartdoc.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class DartDoc {
290290
if (!file.existsSync()) {
291291
return null;
292292
}
293-
Document doc = parse(file.readAsStringSync());
293+
Document doc = parse(file.readAsBytesSync());
294294
Element base = doc.querySelector('base');
295295
String baseHref;
296296
if (base != null) {
@@ -301,6 +301,7 @@ class DartDoc {
301301
.map((link) => link.attributes['href'])
302302
.where((href) => href != null)
303303
.toList();
304+
304305
return new Tuple2(stringLinks, baseHref);
305306
}
306307

@@ -312,6 +313,7 @@ class DartDoc {
312313
fullPath = path.normalize(fullPath);
313314
}
314315

316+
visited.add(fullPath);
315317
Tuple2 stringLinksAndHref = _getStringLinksAndHref(fullPath);
316318
if (stringLinksAndHref == null) {
317319
_warn(package, PackageWarning.brokenLink, pathToCheck,
@@ -335,7 +337,6 @@ class DartDoc {
335337
String newFullPath = path.joinAll([origin, newPathToCheck]);
336338
newFullPath = path.normalize(newFullPath);
337339
if (!visited.contains(newFullPath)) {
338-
visited.add(newFullPath);
339340
_doCheck(package, origin, visited, newPathToCheck, pathToCheck,
340341
newFullPath);
341342
}

lib/src/model.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,12 +1573,15 @@ class Library extends ModelElement {
15731573
return _modelElementsMap;
15741574
}
15751575

1576-
Iterable<ModelElement> get allModelElements sync* {
1577-
for (Set<ModelElement> modelElements in modelElementsMap.values) {
1578-
for (ModelElement modelElement in modelElements) {
1579-
yield modelElement;
1576+
List<ModelElement> _allModelElements;
1577+
Iterable<ModelElement> get allModelElements {
1578+
if (_allModelElements == null) {
1579+
_allModelElements = [];
1580+
for (Set<ModelElement> modelElements in modelElementsMap.values) {
1581+
_allModelElements.addAll(modelElements);
15801582
}
15811583
}
1584+
return _allModelElements;
15821585
}
15831586

15841587
List<ModelElement> _allCanonicalModelElements;

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ packages:
168168
name: mustache4dart
169169
url: "https://pub.dartlang.org"
170170
source: hosted
171-
version: "1.0.12"
171+
version: "1.1.0"
172172
package_config:
173173
description:
174174
name: package_config

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
http_parser: '>=3.0.3 <4.0.0'
1717
logging: '>=0.9.0 <0.12.0'
1818
markdown: ^0.11.2
19-
mustache4dart: ^1.0.9
19+
mustache4dart: ^1.1.0
2020
package_config: '>=0.1.5 <2.0.0'
2121
path: ^1.3.0
2222
resource: ^1.1.0

0 commit comments

Comments
 (0)