-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
object pooling in component core, optimize style parser to reuse object #2951
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
Conversation
src/core/component.js
Outdated
| var schema = this.schema; | ||
| if (typeof data === 'string') { return data; } | ||
| if (isSingleProp(schema)) { return stringifyProperty(data, schema); } | ||
| if (this.isSingleProp) { return stringifyProperty(data, schema); } |
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.
Full name isSinglePropertySchema?
09f0abb to
9ff9cdf
Compare
9ff9cdf to
9bd3f26
Compare
|
Spent a day to get this updated with passing tests. Optimizing the component core, string parsing, and adding in object pooling practices. |
|
@dmarcos r? |
a5a92e2 to
9281409
Compare
|
Updated to not delete the keys when recycling an object, but just set every key to BeforeAfterImprovements: See the |
ba004f8 to
c970cf1
Compare
|
Updated. Still need to polish/comment a bit more (and try to remove the clones for default values). But up and working again. |
|
Tests fail |
|
Moved to #3772 |


Description:
Rather than create a new object each time to create a new
oldData, just have two objects representingoldDataanddata. Also when updating, rather than create a newdataobject, have anewDataobject that is used for holding the new data which then gets copied intodata. So in total, only use three objects:oldData,data,newData.Changes proposed:
style-attrimplementation to be able to pass in an object for reuse instead of creating a new one each time. Also remove lots of callbacks,Object.keys()array creations from their code. Also tweaked to do prettier stringifies. We manage this forked dependency now.oldData.oldData.buildDatafor default value copying.isSingleProp,isSinglePropObject,isObjectBased)styleParserutils a bit to not allocate object + array + use callbacks to convert keys to camelCase.