Skip to content

Conversation

tmilnthorp
Copy link
Collaborator

Static properties should be read-only properties with inline initialization rather than lambdas.

For example, using a lambda for the Zero property would create a new Acceleration(0, BaseUnit) every time it's called, rather than just initializing it once.

A quick test of calling these properties 100,000,000 times showed the lambdas were roughly 10x slower. Not a huge deal but, thought I'd fix it 😃

Static properties should be read-only properties with inline initialization rather than lambdas.
@angularsen
Copy link
Owner

Nice catch! I didn't notice before now.

@angularsen angularsen merged commit 02098b2 into angularsen:master Jan 29, 2019
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

Successfully merging this pull request may close these issues.

2 participants