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
Currently the plugins of the Kibana app team import a lot of redundant code. To speed up loading times of Kibana, we should try to minimize the size of the initial code bundle which is shipped and executed every time Kibana is loaded. There are two general ways to do so:
Get rid of code completely (in case it's not even needed and bundled in because tree shaking doesn't work yet)
Loading things lazily only when required
This issue lists out places for possible quick wins in bundle size improvement:
Plugin boundary optimization
The home plugin exports FeatureCatalogueCategory which causes it to be bundled in a lot of plugins. Can be avoided by converting to a string union
The data plugin export AggGroupNames which is used in some visualization plugins. Can be avoided by converting to a string union
A lot of visualizations are pulling in all of data for some helpers out of esFilters and esQuery helper collections. It would help a lot to move these into a separate plugin (since they are stateless) and make it part of the shared dependencies (not sure how feasible)
The vis_default_editor plugin is just static code used in a lot of places. It can be moved into a shared dependency (like react)
d3 is used in a bunch of visualization plugins and it's difficult to remove it completely - probably makes sense to move into a shared dependency as well
Lodash is used all over the place - it definitely makes sense to move it into a shared dependency
Plugin optimization opportunities
vis_type_vega
In src/plugins/vis_type_vega/public/vega_visualization.js import VegaView and VegaMapView lazily (should make all of the heavy dependencies lazy)
vis_type_timelion
In src/plugins/vis_type_timelion/public/timelion_vis_type.tsx pull in TImelionVisComponent as lazy react component.
vis_type_table
In src/plugins/vis_type_table/public/vis_controller.ts, import getAngularModule and initTableVisLegacyModule lazily
vis_type_metric
In src/plugins/vis_type_metric/public/metric_vis_type.ts, import MetricVisComponent as lazy react component
vis_type_markdown
In src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx, import MarkdownVisComponent as lazy react component
charts
In src/plugins/charts/public/services/colors/colors.ts import MappedColors lazily and only instantiate when createColorLookupFunction is actually called (should get rid of d3 in a few places - only relevant when we can't get it in the shared dependency bundle)
visualize
Looks like data is only bundled in because of the usage of esFilters in src/plugins/visualize/public/plugin.ts
DefaultEditorController can be imported lazily in src/plugins/visualize/public/plugin.ts, and made a type import (maybe by factoring out the methods into a separate interface) in the src/plugins/visualize/public/kibana_services.ts usage (not sure whether necessary)
Currently the plugins of the Kibana app team import a lot of redundant code. To speed up loading times of Kibana, we should try to minimize the size of the initial code bundle which is shipped and executed every time Kibana is loaded. There are two general ways to do so:
This issue lists out places for possible quick wins in bundle size improvement:
Plugin boundary optimization
home
plugin exportsFeatureCatalogueCategory
which causes it to be bundled in a lot of plugins. Can be avoided by converting to a string uniondata
plugin exportAggGroupNames
which is used in some visualization plugins. Can be avoided by converting to a string uniondata
for some helpers out ofesFilters
andesQuery
helper collections. It would help a lot to move these into a separate plugin (since they are stateless) and make it part of the shared dependencies (not sure how feasible)vis_default_editor
plugin is just static code used in a lot of places. It can be moved into a shared dependency (like react)Plugin optimization opportunities
vis_type_vega
src/plugins/vis_type_vega/public/vega_visualization.js
importVegaView
andVegaMapView
lazily (should make all of the heavy dependencies lazy)vis_type_timelion
src/plugins/vis_type_timelion/public/timelion_vis_type.tsx
pull inTImelionVisComponent
as lazy react component.vis_type_table
src/plugins/vis_type_table/public/vis_controller.ts
, importgetAngularModule
andinitTableVisLegacyModule
lazilyvis_type_metric
src/plugins/vis_type_metric/public/metric_vis_type.ts
, importMetricVisComponent
as lazy react componentvis_type_markdown
src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx
, importMarkdownVisComponent
as lazy react componentcharts
src/plugins/charts/public/services/colors/colors.ts
importMappedColors
lazily and only instantiate whencreateColorLookupFunction
is actually called (should get rid of d3 in a few places - only relevant when we can't get it in the shared dependency bundle)visualize
data
is only bundled in because of the usage ofesFilters
insrc/plugins/visualize/public/plugin.ts
DefaultEditorController
can be imported lazily insrc/plugins/visualize/public/plugin.ts
, and made a type import (maybe by factoring out the methods into a separate interface) in thesrc/plugins/visualize/public/kibana_services.ts
usage (not sure whether necessary)dashboard
data
is only bundled in because ofkibana/src/plugins/dashboard/public/plugin.tsx
Line 43 in 2f794e6
initAngularBootstrap
inkibana/src/plugins/dashboard/public/plugin.tsx
Line 60 in 2f794e6
graph
x-pack/plugins/graph/public/helpers/saved_workspace_utils.ts
- looks easily avoidableinitAngularBootstrap
inkibana/x-pack/plugins/graph/public/plugin.ts
Line 13 in 7d12b76
@restrry
The text was updated successfully, but these errors were encountered: