-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Don't store request specific data into the Layer object #113
Open
Congelli501
wants to merge
3
commits into
pillarjs:master
Choose a base branch
from
blgCloud:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
This code has been around in this state for a very long time. My worry is that this new way creates garbage to collect (the new object added) on a hot path, which might be the reason it was done this way in the first place. Maybe @dougwilson will remember because this predates me by quite a bit. Without more context I would like to see us do some sort of performance pass on this since I don't think the feature addition would be worth it if we impacted performance in a negative way.
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.
A big part was preventing bail out due to the same variable being different shapes (i.e. here we now have something that can be a bool or an object, and v8 will struggle to make a bytecode and may be falling back to slow interpreter mode). Ideally if we want to keep things in hot paths fast they should definitely keep the same shapes for the byte code generator.
I don't remember off hand all the details for why it was mutating properties, but it was very likely to reduce generating a bunch of little objects only to trash them immediately. That can be addressed if an object pool is used for them, however.
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.
I haven't run through a perf yet as I am away, but I suspect using
null
instead offalse
would fix any bail outs since those would both be objectsThere 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.
Yeah that is a good point as well. I think ideally we have some real world benchmarks to base these decisions off of, but I think in theory both the de-opt from different shapes and increased GC from these little objects will be perf regressions. It would be nice to comment these with links to the benchmarks at some point so that the context is kept in the code for future contributors.
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.
So far what I have done is run the perf with the test suite, which the deopts from there usually pretty low hanging fruit.
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.
But ya, if it needs a shaped object can make a no match object at the top level and return that reference for the no match
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.
I made the change to use
null
instead offalse
for the no match scenario (I added a new commit to help reading the new changes, but I can squash them if you prefer).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.
I am not sure I see how that addresses the worry here. The change you made does mean you could return some of those boolean checks back to their original form I think, which is overall good to reduce the change for change's sake, but I think this comment thread here is about the method returning a boolean and not producing unnecessary garbage in the process.
I am not suggesting removing the last changes, but I think ideally we find a way to not create these objects yet still clean up the state after the layers are finished being handled.