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

Reduce core bundle size #95890

Open
6 of 10 tasks
Tracked by #88678
mshustov opened this issue Mar 31, 2021 · 2 comments
Open
6 of 10 tasks
Tracked by #88678

Reduce core bundle size #95890

mshustov opened this issue Mar 31, 2021 · 2 comments
Labels
performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@mshustov
Copy link
Contributor

mshustov commented Mar 31, 2021

Parent issue #95853

Core bundle size is critical for performance because it's loaded on every page and delays all other plugin initialization affecting perceived UI performance.

There are still lots of options to improve Core bundle size, just a few ideas:

We don't aim to abide by the 100KB limit set for plugins. The limit bundle size value for Core should be investigated as a part of this issue.

@mshustov mshustov added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Mar 31, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor

pgayvallet commented Apr 1, 2021

Not sure we can gain much with async loading UI components in core, as we are just delegating to EUI which is already a shared dep.

E.g

  • overlays/banners

The banners service is already lazy loading react-markdown

const ReactMarkdownLazy = React.lazy(() => import('react-markdown'));

The rest of the UI component in UserBannerService is mostly using EUI. Async loading that would be a gain of less than 1kb.

  • overlays/flyouts

Only UI component here is

render(
<i18n.Context>
<EuiFlyout {...options} onClose={() => flyout.close()}>
<MountWrapper mount={mount} className="kbnOverlayMountWrapper" />
</EuiFlyout>
</i18n.Context>,
this.targetDomElement
);

As @elastic/eui is already a shared dep, we wouldn't gain anything here

  • overlays/modal

Same, UI comp is only a passthough to EUI

render(
<i18n.Context>
<EuiConfirmModal {...props} />
</i18n.Context>,
targetDomElement
);

  • notifications/toasts

The toast list is currently rendered during startup

public start({ i18n, overlays, targetDomElement }: StartDeps) {
this.api!.start({ overlays, i18n });
this.targetDomElement = targetDomElement;
render(
<i18n.Context>
<GlobalToastList
dismissToast={(toastId: string) => this.api!.remove(toastId)}
toasts$={this.api!.get$()}
/>
</i18n.Context>,
targetDomElement
);

Changing to lazy load would force us to adapt the code to only render the component when a first toast is actually received.

Also GlobalToastList is a very thin wrapper around EUI's EuiGlobalToastList, and as @elastic/eui is already in the shared deps, the gain would only be of a few bytes.

So I don't think we should do anything for overlays/banners

  • fatal_errors

Opened a PR #96020 to try that one. I guess the gain will be negligible too, but waiting for CI.

@lizozom lizozom changed the title Reduce Kibana Core bundle size Reduce core bundle size Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants