Skip to content
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

Remove DeveloperError in release build #1240

Closed
pjcozzi opened this issue Oct 12, 2013 · 2 comments
Closed

Remove DeveloperError in release build #1240

pjcozzi opened this issue Oct 12, 2013 · 2 comments
Labels
good first issue An opportunity for first time contributors type - enhancement

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Oct 12, 2013

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 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.
  • 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).

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Oct 13, 2013

Although outside the scope of this issue, if we use the preprocessor, there are other things we can exclude from release builds like debugShowBoundingVolume.

@pjcozzi pjcozzi mentioned this issue Nov 7, 2013
72 tasks
@pjcozzi
Copy link
Contributor Author

pjcozzi commented Nov 15, 2013

The infrastructure for this was added in #1296. We still need to add pragmas to most places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An opportunity for first time contributors type - enhancement
Projects
None yet
Development

No branches or pull requests

1 participant