This repository has been archived by the owner on Mar 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Provides a slight optimization on hot paths, but generally is a better practice for performance.
Avoid looping over calls that can be done in shot and utilize closers rather than binds.
Avoid cloning context when otherwise unnecessary.
Avoid arguments deoptimization cases.
Avoid repeated parsing operations and other potential performance issues.
Allows us to avoid global variables and causes an approximately 6x increase in the performance of this method.
Since data rendering is now default in handlebars and the errors will reference data and also occur early in the dev process, the overhead both for wire size and runtime exec of this sanity check does not seem worthwhile.
Increases the overall render performance on newer runtimes due to avoiding a copy of the view/current context on execution. This has the side effect of `context` now returning a non-cloned object. Callers should take care to not modify the returned object.
This allows lumbar consumers to conditionally include this behavior. Longer term we will want to look at per-view options that let us conditionally include the form handling behavior (or make a definitive we do not support call)
@@ -213,7 +213,8 @@ Thorax.CollectionView = Thorax.View.extend({ | |||
itemView = model; | |||
model = false; | |||
} else { | |||
index = index || collection.indexOf(model) || 0; | |||
index = index != null ? index : (collection.indexOf(model) || 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micro opt: Avoids indexOf lookup for index === 0
case. Likely fast but felt like a why not avoid the call sort of case.
Released in 3.0.0-beta.4 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A whole slew of macro and micro optimizations. These are generally non breaking but there are a few changes that may break some workflows.
helper:$name
event has been removed. Users should bind to thehelper
event and check the name parameter that they wish to examine._.uniqueId
no longer uses global variables for tracking state. Instead callers must call_resetIdCounter
when wishing to modify that behavior.context
no longer clones the model attributes so callers need to take care to not modify the returned value.