-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
reduce memory allocation in component update core codepath #3772
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
Changes from all commits
8ce5d96
f262c63
6a9ee26
ece2fe8
f87c296
784aafb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,10 +53,16 @@ module.exports.Component = registerComponent('material', { | |
| }, | ||
|
|
||
| updateSchema: function (data) { | ||
| var newShader = data.shader; | ||
| var currentShader = this.data && this.data.shader; | ||
| var shader = newShader || currentShader; | ||
| var schema = shaders[shader] && shaders[shader].schema; | ||
| var currentShader; | ||
| var newShader; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unrelated to PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes test, checks for data / oldData existence |
||
| var schema; | ||
| var shader; | ||
|
|
||
| newShader = data && data.shader; | ||
| currentShader = this.oldData && this.oldData.shader; | ||
| shader = newShader || currentShader; | ||
| schema = shaders[shader] && shaders[shader].schema; | ||
|
|
||
| if (!schema) { error('Unknown shader schema ' + shader); } | ||
| if (currentShader && newShader === currentShader) { return; } | ||
| this.extendSchema(schema); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,12 +21,16 @@ module.exports.Component = registerComponent('obj-model', { | |
| update: function () { | ||
| var data = this.data; | ||
| if (!data.obj) { return; } | ||
| this.remove(); | ||
| this.resetMesh(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated to the purpose of the PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes a test |
||
| this.loadObj(data.obj, data.mtl); | ||
| }, | ||
|
|
||
| remove: function () { | ||
| if (!this.model) { return; } | ||
| this.resetMesh(); | ||
| }, | ||
|
|
||
| resetMesh: function () { | ||
| this.el.removeObject3D('mesh'); | ||
| }, | ||
|
|
||
|
|
||
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.
unrelated to PR?
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.
yes, it checks for oldData rather than data