forked from tensorflow/tensorboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use esbuild for javascript bundling. (tensorflow#5829)
* Motivation for features / changes The upcoming Angular 13 upgrade breaks our custom tf_dev_js_binary rule, which we used for fast, unminified bundling of the tensorboard:dev target. * Technical description of changes One straighforward solution is to move all of our javascript bundling to the esbuild bundler. It is just as fast as our custom bundling in tf_dev_js_binary and much faster than the rollup+terser combination we've been using for bundling our production build. The bundles it generates also tend to be smaller than the bundles we are currently generating. By using esbuild in our tf_js_binary rule we can migrate all bundling to this single rule and eliminate tf_dev_js_binary rule. The only difference between a "prod" and "dev" target is whether we choose to minify or not. We can also remove rollup and terser from our project. See: https://esbuild.github.io/ Note that bazel documents how to use esbuild with ts_project but not with ts_library. We managed to get it to work but its long-term support is unknown. https://www.npmjs.com/package/@bazel/esbuild * Detailed steps to verify changes work correctly (as executed by you) For core TensorBoard app: * `bazel run tensorboard` and `bazel run tensorboard:dev`. * Simple check of 'Time Series', 'Scalars', 'Images', 'Graphs', 'Distributions', 'Histograms', 'Text', and 'Hparams'. * Set 'pagination limit' in the settings and ensure it is honored by the 'Time Series' and 'Images' plugins - this ensures the angular/polymer bridge is working. * Set 'ignore outliers in chart scaling' in both 'Time Series' and 'Scalars' plugins and refresh and verify the changes are honored. - this ensures integration with local storage is still working. * Check the 'Debugger' plugin and the Monaco code editor is working within it. I also verified that other binaries using tf_js_binary rule still seem to work: * chart_worker.js * tf_graph_app * vz_projector * tensor_widget (could only verify it builds, couldn't figure out how to render it) I checked that bundle times are noticeably faster. * for the prod build of tb_webapp_binary.js, the rollup+terser bundling could be 20s to 30s. but with esbuild it is just 1s. * for the dev build of tb_webapp_binary.js, there is not really any noticeable performance gain. I checked bundle sizes. They actually all end up being smaller: * At commit 0f4d6e9 * For the production app with minified binaries: * bazel-bin/tensorboard/webapp/tb_webapp_binary.js 4378795 (vs 4464436) * bazel-bin/tensorboard/components/polymer3_lib_binary.js 3166751 (vs 3177827) * bazel-bin/tensorboard/webapp/index.js 7631949 (vs 7728765) * For the dev app with unminified binaries: * bazel-bin/tensorboard/webapp/dev_assets/tb_webapp_binary.js 7190752 (vs 26059122) * bazel-bin/tensorboard/webapp/dev_assets/polymer3_lib_binary_dev.js 6124163 (vs 8121074)
- Loading branch information
1 parent
9ba9fd0
commit 5c36d11
Showing
11 changed files
with
64 additions
and
442 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.