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

Side by Side Diff: pkg/analyzer/lib/src/analyzer_impl.dart

Issue 195563003: Increase Dart based command line analyzer cache size to 512. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Really inscrease to 512 Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_impl; 5 library analyzer_impl;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as pathos; 9 import 'package:path/path.dart' as pathos;
10 10
11 import 'generated/java_io.dart'; 11 import 'generated/java_io.dart';
12 import 'generated/engine.dart'; 12 import 'generated/engine.dart';
13 import 'generated/error.dart'; 13 import 'generated/error.dart';
14 import 'generated/source_io.dart'; 14 import 'generated/source_io.dart';
15 import 'generated/sdk.dart'; 15 import 'generated/sdk.dart';
16 import 'generated/sdk_io.dart'; 16 import 'generated/sdk_io.dart';
17 import 'generated/ast.dart'; 17 import 'generated/ast.dart';
18 import 'generated/element.dart'; 18 import 'generated/element.dart';
19 import '../options.dart'; 19 import '../options.dart';
20 20
21 /**
22 * The maximum number of sources for which AST structures should be kept in the cache.
23 */
24 const int _MAX_CACHE_SIZE = 512;
21 25
22 DartSdk sdk; 26 DartSdk sdk;
23 27
24 /// Analyzes single library [File]. 28 /// Analyzes single library [File].
25 class AnalyzerImpl { 29 class AnalyzerImpl {
26 final CommandLineOptions options; 30 final CommandLineOptions options;
27 31
28 ContentCache contentCache = new ContentCache(); 32 ContentCache contentCache = new ContentCache();
29 SourceFactory sourceFactory; 33 SourceFactory sourceFactory;
30 AnalysisContext context; 34 AnalysisContext context;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (packageDirectory != null) { 104 if (packageDirectory != null) {
101 resolvers.add(new PackageUriResolver([packageDirectory])); 105 resolvers.add(new PackageUriResolver([packageDirectory]));
102 } 106 }
103 } 107 }
104 sourceFactory = new SourceFactory(resolvers); 108 sourceFactory = new SourceFactory(resolvers);
105 context = AnalysisEngine.instance.createAnalysisContext(); 109 context = AnalysisEngine.instance.createAnalysisContext();
106 context.sourceFactory = sourceFactory; 110 context.sourceFactory = sourceFactory;
107 111
108 // set options for context 112 // set options for context
109 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); 113 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
110 contextOptions.cacheSize = 256; 114 contextOptions.cacheSize = _MAX_CACHE_SIZE;
111 contextOptions.hint = !options.disableHints; 115 contextOptions.hint = !options.disableHints;
112 context.analysisOptions = contextOptions; 116 context.analysisOptions = contextOptions;
113 } 117 }
114 118
115 /// Fills [sources]. 119 /// Fills [sources].
116 void prepareSources(LibraryElement library) { 120 void prepareSources(LibraryElement library) {
117 var units = new Set<CompilationUnitElement>(); 121 var units = new Set<CompilationUnitElement>();
118 var libraries = new Set<LibraryElement>(); 122 var libraries = new Set<LibraryElement>();
119 addLibrarySources(library, libraries, units); 123 addLibrarySources(library, libraries, units);
120 } 124 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 var internalPath = pathos.join(libraryDirectory, '_internal') + pathos.s eparator; 204 var internalPath = pathos.join(libraryDirectory, '_internal') + pathos.s eparator;
201 if (!filePath.startsWith(internalPath)) { 205 if (!filePath.startsWith(internalPath)) {
202 return UriKind.DART_URI; 206 return UriKind.DART_URI;
203 } 207 }
204 } 208 }
205 } 209 }
206 // some generic file 210 // some generic file
207 return UriKind.FILE_URI; 211 return UriKind.FILE_URI;
208 } 212 }
209 } 213 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698