Open
Conversation
Despite adding more code in a few places, removal of the unused variables in `W.setState` end up saving space overall. w.min.full.js: 8553 bytes (-29) w.min.lite.js: 6132 bytes (-19) w.min.full.zip: 2745 bytes (-7) w.min.lite.zip: 2119 bytes (-10)
Several things have been optimized here: * Input to the function is now a model, instead of a state object * The iterator logic has been reworked, saving bytes and a variable * The polygon "hash" has been saved to a variable, saving bytes * Additionally, it is now created using Array.prototype.join, saving even more bytes compared to previous commit: w.min.full.js: 8237 bytes (-316) w.min.lite.js: 6132 bytes (±0) w.min.full.zip: 2709 bytes (-36) w.min.lite.zip: 2119 bytes (±0)
* Model has been moved to a variable, access now uses fewer bytes * Changed "compute only" functionality * Flag is now implicit, if model does not exist * In debug mode, trying to render a model that does not exist (and is not "camera", "light" or "group") will emit a warning * Moved buffer building logic to `W.render` * This was done since we already have the model in a variable in that scope, freeing up bytes compared to previous commit: w.min.full.js: 7732 bytes (-505) w.min.lite.js: 5642 bytes (-490) w.min.full.zip: 2660 bytes (-49) w.min.lite.zip: 2065 bytes (-54)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I found a couple of potential improvements in the model handling code used throughout the framework. Using the build scripts previously introduced, I was able to measure precisely what did and didn't help reduce the file size.
What has changed:
W.smoothhas had several byte-saves addedArray.prototype.join) is reused from a variableW.renderFile size changes: