You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A quick test shows that we can drop ~100 KB from the ~1.2 MB minified Cesium.js if we remove the developer errors. I expect this will also reduce the size of AMD-based apps quite a bit. Although it is not significant compared to the graphics assets downloaded, it is significant for the initial load.
We can expect a minor performance win too; however, I no longer see defined on any profiles.
Here's a few options for implementing this:
Use a RegEx to replace the DeveloperError strings with an empty string or even the filename and line number.
Surround the DeveloperErrorif blocks with a #ifdef and use the JS minifier preprocessor. Be careful not to include side-effects, e.g., i++, inside the #ifdef block. This will reduce the size even more and may improve performance. In order for the default build to work, the preprocessor commands would need to be commented out so the browsers don't choke on them.
Inject if (false) { /* ... */ } blocks at build time and let the minifier remove them. However, this is dangerous for side-effects since it's not obvious to the original developer.
I'd probably go with (1) and then maybe (2).
The text was updated successfully, but these errors were encountered:
Although outside the scope of this issue, if we use the preprocessor, there are other things we can exclude from release builds like debugShowBoundingVolume.
A quick test shows that we can drop ~100 KB from the ~1.2 MB minified Cesium.js if we remove the developer errors. I expect this will also reduce the size of AMD-based apps quite a bit. Although it is not significant compared to the graphics assets downloaded, it is significant for the initial load.
We can expect a minor performance win too; however, I no longer see
defined
on any profiles.Here's a few options for implementing this:
DeveloperError
strings with an empty string or even the filename and line number.DeveloperError
if
blocks with a#ifdef
and use the JS minifier preprocessor. Be careful not to include side-effects, e.g.,i++
, inside the#ifdef
block. This will reduce the size even more and may improve performance. In order for the default build to work, the preprocessor commands would need to be commented out so the browsers don't choke on them.if (false) { /* ... */ }
blocks at build time and let the minifier remove them. However, this is dangerous for side-effects since it's not obvious to the original developer.I'd probably go with (1) and then maybe (2).
The text was updated successfully, but these errors were encountered: