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

Replace color strings with Color.CONSTANTs #312

Closed
samreid opened this issue Aug 31, 2017 · 3 comments
Closed

Replace color strings with Color.CONSTANTs #312

samreid opened this issue Aug 31, 2017 · 3 comments
Assignees

Comments

@samreid
Copy link
Member

samreid commented Aug 31, 2017

For instance, Panel.js has:

  var DEFAULT_OPTIONS = {
    fill: 'white',
    stroke: 'black',
    lineWidth: 1, // width of the background border

Using colors like that instantiates extra objects and takes more work, it seems it would be better to use Color.WHITE and Color.BLACK. I'm seeing many occurrences of 'white' and 'black' throughout the sim. @jonathanolson can you confirm that this would be a desirable change?

@jonathanolson
Copy link
Contributor

It may be a minor memory/performance win to directly reference color objects like that. Probably not significant unless there are a large number of objects of a specific type.

@samreid
Copy link
Member Author

samreid commented Sep 8, 2017

Perhaps we should keep this in mind for sims that are known to have performance problems. Maybe I'll add a section to the developer guide?

@samreid
Copy link
Member Author

samreid commented Sep 8, 2017

The development overview is now sporting a performance section: #312

@samreid samreid closed this as completed Sep 8, 2017
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

2 participants