New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pubspec caching #1814
pubspec caching #1814
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have concerns about this approach to caching.
final filePath = path.join(context.package.root, 'pubspec.yaml'); | ||
final entry = cache[filePath]; | ||
if (entry != null) { | ||
if (entry.file.modificationStamp != entry.timestamp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting the modification stamp is not as inexpensive as you might hope, and this gets it twice: once here and once in update
.
} | ||
|
||
class Pubspec { | ||
static Map<String, Entry> cache = <String, Entry>{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no way to flush the cache, so it is effectively a slow memory leak.
@@ -2,13 +2,15 @@ | |||
// for details. All rights reserved. Use of this source code is governed by a | |||
// BSD-style license that can be found in the LICENSE file. | |||
|
|||
import 'dart:io'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't tell where this is being used, but it's somewhat concerning if we really need it.
Right. Too many problems with this approach. Neverminding the leak, a few runs show the benefits are negligible (and under some circumstances actually negative). Discussion ongoing in #1813 but closing this for now. |
Before: