Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Collect fine-grained statistics on memory usage #1782

Closed
wants to merge 2 commits into from

Conversation

NTillmann
Copy link
Contributor

Release notes: Collect fine-grained statistics on memory usage

This refactoring does a few things:

  • Introduce a much nicer measure abstract to wrap computations for which we want to measure something
  • Measure not only time, but also heap usage
  • Project data to legacy statistics file format.
  • Limit scope of intermediate serialized information to further reduce memory usage

realm: Realm;

_newCapturedScopeInstanceIdx: number;
referentializationState: Map<ReferentializationScope, ReferentializationState>;
_referentializedNameGenerator: NameGenerator;

getStatistics(): SerializerStatistics {
invariant(this.realm.statistics instanceof SerializerStatistics);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These invariants make me feel uneasy. As always, I strongly recommend adding a comment explaining why this must always be true. I can't say that I understand the changes in this PR well enough to convince myself about this.

@@ -60,7 +60,7 @@ export class Referentializer {
_referentializedNameGenerator: NameGenerator;

getStatistics(): SerializerStatistics {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better would be to also change this method name to getSerializerStatistics.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Release notes: Collect fine-grained statistics on memory usage

This refactoring does a few things:
- Introduce a much nicer `measure` abstract to wrap computations for which we want to measure something
- Measure not only time, but also heap usage
- Project data to legacy statistics file format.
- Limit scope of intermediate serialized information to further reduce memory usage
- Fixing reporting issues.
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NTillmann is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants