Skip to content
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

Closed
wants to merge 1 commit into from
Closed

pubspec caching #1814

wants to merge 1 commit into from

Conversation

pq
Copy link
Member

@pq pq commented Nov 1, 2019

Before:

image

Copy link
Member

@bwilkerson bwilkerson left a 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) {
Copy link
Member

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>{};
Copy link
Member

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';
Copy link
Member

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.

@pq
Copy link
Member Author

pq commented Nov 1, 2019

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.

@pq pq closed this Nov 1, 2019
@pq pq deleted the ps_caching branch July 28, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants