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

factor out constants for option and var values #107

Closed
20 of 23 tasks
pixelzoom opened this issue Nov 9, 2018 · 2 comments
Closed
20 of 23 tasks

factor out constants for option and var values #107

pixelzoom opened this issue Nov 9, 2018 · 2 comments
Assignees

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Nov 9, 2018

Creating this issue after a Slack discussion with @samreid.

Some option and var values that could be factored out as constants. Cumulatively these might make a bit of a difference in memory footprint.

More that 1 instance of these is created (number of instances in parens):

  • AxisOfSymmetryNode (2): font
  • CoefficientSlider (6): map, inverseMap, tickValues, trackSize, thumbSize
  • CoordinatesNode (14): font
  • GQCheckbox (19): font
  • GQGraphNode (4): otherCurves, decorations
  • GQManipulator (4): layoutCoordinates, phetioComponentOptions
  • PointToolNode (8): font
  • QuadraticNode (11): font

Only 1 instance of these is created:

  • DirectrixNode: font
  • ExploreInteractiveEquationNode.EquationNode: font
  • FocusAndDirectrixEquationNode: font, fractionFont
  • FocusAndDirectrixInteractiveEquationNode.EquationNode: font
  • FocusAndDirectrixModel: numberPropertyOptions
  • GQScreenIconFactory: see defaults in createQuadraticNode
  • NoRealRoots: font
  • PointNode: layoutCoordinates
  • QuadraticTermsAccordionBox: font
  • StandardFormEquationNode: font
  • StandardFormInteractiveEquationNode: font
  • StandardFormModel: numberPropertyOptions
  • VertexFormEquationNode: font
  • VertexFormInteractiveEquationNode: font
  • VertexFormModel: numberPropertyOptions
@pixelzoom pixelzoom self-assigned this Nov 9, 2018
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Nov 10, 2018

Mentioning @samreid, since we had discussed the potential benefit of this on Slack, in relation to phetsims/tandem#71.

I tried factoring out constants for the default option values identified in #107 (comment). I did only the ones that are checked in that list, focusing on the classes that are instantiated more than once.

Here are the heap snapshots on Chrome 70.0.3538.77 + macOS 10.11.6, ?ea&brand=phet&fuzz, before and after factoring out these constants.

Time (minutes) Before After
0 44.2 MB 44.1 MB
2 51.5 MB 51.7 MB

Since there is no obvious memory reduction, I'm not going to commit the changes.

@pixelzoom pixelzoom reopened this Nov 11, 2018
@pixelzoom
Copy link
Contributor Author

Reopening. I think I might commit some of this anyway.

pixelzoom added a commit that referenced this issue Nov 12, 2018
Signed-off-by: Chris Malley <[email protected]>
pixelzoom added a commit that referenced this issue Nov 12, 2018
pixelzoom added a commit that referenced this issue Nov 12, 2018
pixelzoom added a commit that referenced this issue Nov 12, 2018
pixelzoom added a commit that referenced this issue Nov 12, 2018
Signed-off-by: Chris Malley <[email protected]>
pixelzoom added a commit that referenced this issue Nov 12, 2018
Signed-off-by: Chris Malley <[email protected]>
pixelzoom added a commit that referenced this issue Nov 12, 2018
Signed-off-by: Chris Malley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant