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

Ck editor initializing is so slow. #82

Closed
afwn90cj93201nixr2e1re opened this issue Jul 20, 2019 · 29 comments
Closed

Ck editor initializing is so slow. #82

afwn90cj93201nixr2e1re opened this issue Jul 20, 2019 · 29 comments
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).

Comments

@afwn90cj93201nixr2e1re
Copy link

Comment.

@Mgsy
Copy link
Member

Mgsy commented Jul 22, 2019

@oleq, can you take a look at this one?

@oleq
Copy link
Member

oleq commented Jul 22, 2019

What's the version of ckeditor5-vue? Also, can you confirm it's the same in the stable version of Firefox?

@oleq oleq added the pending:feedback This issue is blocked by necessary feedback. label Jul 22, 2019
@oleq
Copy link
Member

oleq commented Jul 22, 2019

Can you share the editor data you're using to initialize it?

@oleq
Copy link
Member

oleq commented Jul 22, 2019

I cannot reproduce it.

In an empty directory, I called:

yarn add vue @ckeditor/ckeditor5-vue @ckeditor/ckeditor5-build-decoupled-document

Then I used the following index.html.

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
	</head>
	<body>
		<h1>Hello world!</h1>
		
		<div id="app">
			<ckeditor :editor="editor" v-model="editorData" @ready="onReady"></ckeditor>
		</div>

		<script src="node_modules/vue/dist/vue.min.js"></script>
		<script src="node_modules/@ckeditor/ckeditor5-build-decoupled-document/build/ckeditor.js"></script>
		<script src="node_modules/@ckeditor/ckeditor5-vue/dist/ckeditor.js"></script>

		<script>
			Vue.use( CKEditor );

			const app = new Vue( {
				el: '#app',
				data: {
					editor: DecoupledEditor,
					editorData: '<p>Content of the editor.</p>',
				},
				methods: {
					onReady( editor ) {
						// Insert the toolbar before the editable area.
						editor.ui.getEditableElement().parentElement.insertBefore(
							editor.ui.view.toolbar.element,
							editor.ui.getEditableElement()
						);
					}
				}
			} );
		</script>
		<style>
			.ck.ck-editor__editable_inline {
				border: 1px solid #ccc;
			}
		</style>
	</body>
</html>

I cannot say its blazingly fast (because it's still 0.5MB JS in the CKEditor build), but it's nothing like 3s of waiting. Can you confirm using this minimal sample?

@oleq
Copy link
Member

oleq commented Jul 22, 2019

I mean, do you experience the lag when using the sample I provided?

@oleq
Copy link
Member

oleq commented Jul 22, 2019

It takes around .6s on my machine (i7 Macbook Pro)

image

It could be that it takes more than 1s on low–end hardware but it's far from 3s like you mentioned.

@Mgsy
Copy link
Member

Mgsy commented Aug 5, 2019

I'm closing this issue as we're not able to reproduce the problem. If you'll have some more information about it, feel free to comment - we'll check it.

@Mgsy Mgsy closed this as completed Aug 5, 2019
@Mgsy Mgsy added resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). and removed pending:feedback This issue is blocked by necessary feedback. labels Aug 5, 2019
@afwn90cj93201nixr2e1re
Copy link
Author

@oleq i tested some another wysiwyg component's.
Froala first instance load - 0.7s.
Each next instance on page loading take ~0.6s.

Scrumpy - first instance load - 0.5s.
Each next instance on page loading take 0.5s.

I tested this with full plugin's list enabled.

But ckeditor decoupled loading take's too much time on notebook's for example. But there not too much plugins like in froala, which loading too faster.

изображение

@afwn90cj93201nixr2e1re
Copy link
Author

So, maybe you should take some test's and detect which one function loading takes too much time?
Coz this is very bad now.
Only Bold, Italic and text highliting plugins enabled by default.

@oleq
Copy link
Member

oleq commented Aug 12, 2019

See #82 (comment)

Without the content you load into the editor it's hard for us to test or relate to your issue.

@afwn90cj93201nixr2e1re
Copy link
Author

I said, it's empty.
Im using your example. xD.
#82 (comment)

It's not related to data rendering at all, it's some js/timeouts/promises problem.

@Reinmar
Copy link
Member

Reinmar commented Aug 12, 2019

Could you provide a sample, with all the code and dependencies on which we could reproduce this (ideally, a repository)? Just to be sure we're looking at the exact same thing. Right now, we don't see any major issue but perhaps we're checking something slightly different than you.

Also, please share a screenshot of a timeline recorded on this demo.

@afwn90cj93201nixr2e1re
Copy link
Author

test123.zip

profile.zip

As i said above im using empty project for testing.
And it takes near 3 seconds.

GIF

@oleq
Copy link
Member

oleq commented Aug 13, 2019

Thanks for the sample and the profile. I used the sample and here are the results:

@afwn90cj93201nixr2e1re 's waterfall (~3,5s)

image

My waterfall (~0,7s)

image


I admit the difference is huge (it's around 5x) and TBH I'm not sure why. Could it be my hardware is 5 times faster in that case?

I tested in vanilla Firefox 68.0.1 (64-bit) (no add-ons etc.). Can you @afwn90cj93201nixr2e1re perform the same test in a clean Firefox installation? Just to make sure we're on the same page.

@afwn90cj93201nixr2e1re
Copy link
Author

afwn90cj93201nixr2e1re commented Aug 13, 2019

it was clean. it's not related to browser or cpu, i mean more huge wyswigs initiazing take near 0.5s(#82 (comment)), but with ckeditor it take's near 3s.
Im on i9 8950HK, 2.9.

Maybe you can create some build with debug where we can find info about how many time takes each function?

@oleq
Copy link
Member

oleq commented Aug 14, 2019

I ran the same test on another machine (Windows 10 this time) with a 10-year old CPU (Phenom II X4) and it took 1.5s to initialize the editor:

Untitled

We know there's room for improvement (in various parts of the editor framework) but it's not nearly as bad as you suggest. And given your hardware configuration (Intel i9) this is even more disturbing because the editor should initialize way, way faster.

So my guess it's either your OS (which one, BTW? Is it Linux?) or some other components (GPU?) causing some issues. Maybe you could try and run this demo on another machine and we could compare the results?

Anyway, this is the first time we see a performance issue this off the scale. There were some in the past but this is a new level. Unless we have more data (cases), it's hard for us to figure anything out because (as you saw) I tried to reproduce the problem but to no avail. Sorry 😔

@afwn90cj93201nixr2e1re
Copy link
Author

afwn90cj93201nixr2e1re commented Aug 14, 2019

What about this one? It's also can help to check which function initializing take's too much in future

Maybe you can create some build with debug where we can find info about how many time takes each function?

7/8.1/10 win, 1060 6gb, 16gb RAM.

@oleq
Copy link
Member

oleq commented Aug 14, 2019

What about this one? It's also can help to check which function initializing take's too much in future

You can get this information straight, e.g. from Chrome dev tools (waterfall in the performance tab). There are plenty of functions that are used excessively and could be optimized but there's no single culprit here (like "one place to fix it all").

@afwn90cj93201nixr2e1re
Copy link
Author

No, i can't. Coz it's minized. And here no options to get each function executing time.

@pshurygin
Copy link

@oleq I wonder if there is any way to improve startup performance. I'm initializing ckeditor on user click and it takes about 400-800ms on my desktop i7 6700, which is a noticable delay. If i do the same with 4x throttling in dev tools, this time goes up to 3s+, which means it is pretty much unusable for people with low-spec laptops.

I'm talking here about initializing editor with just a few words without any initial formatting, so that it is not the input size problem. Also, i'm using custom build with just the plugins i need(pretty close to the official balloon build).

Maybe there is some way to pre-initialize ckeditor without content and without adding it to DOM? Or some other workaround to improve startup performance with initialize-on-click strategy.

@oleq
Copy link
Member

oleq commented Nov 15, 2019

@pshurygin Do you experience this lag using the Vue adapter only or also when using the vanilla CKEditor API (SomeEditor.create())? I'm trying to find the root of the problem.

@afwn90cj93201nixr2e1re
Copy link
Author

Can you create vue app with vanilla CKEditor initializing with checkbox, xD? We are not familiar with CKEditor like you.

@afwn90cj93201nixr2e1re
Copy link
Author

изображение

@afwn90cj93201nixr2e1re
Copy link
Author

afwn90cj93201nixr2e1re commented Nov 15, 2019

xD, that's strange, with async await it takes 2 seconds.
изображение

Sometimes:
изображение

@afwn90cj93201nixr2e1re
Copy link
Author

изображение

@pshurygin
Copy link

@oleq I'm using vanilla api BalloonEditor.create()

@afwn90cj93201nixr2e1re
Copy link
Author

So, i can confirm that the problem is not in css files and svg boxes, xD:
изображение

But browser throw attention that will-change require too much memory.

@afwn90cj93201nixr2e1re
Copy link
Author

afwn90cj93201nixr2e1re commented Nov 15, 2019

First init:
изображение

Second init:
изображение

So, the most time seems taken by ui init.

Especially by toolbar init(it's second init on same page, first init just * 2):
изображение

Here is too many .map iterations, so, i think that we should avoid it if its possible.

@thorgeir
Copy link

Hi, I just overcame a painfully slow initialization of ckeditor 5.
Turns out the sample code given on ckeditor.com for the webpack.config.js was to blame.

What I changed was this section in webpack.config.js:

test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
use: [
	{
		loader: 'style-loader',
		options: {
			injectType: 'singletonStyleTag',
			attributes: {
				'data-cke': true
			}
		}
	},
	{
		loader: 'postcss-loader',
		options: styles.getPostCssConfig({
			themeImporter: {
				themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
			},
			minify: true
		})
	},
]

To

test: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css$/,
use: [
	{
		loader: MiniCssExtractPlugin.loader,
	},
	{
		loader: 'postcss-loader',
		options: styles.getPostCssConfig({
			themeImporter: {
				themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
			},
			minify: true
		})
	},
]

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior).
Projects
None yet
Development

No branches or pull requests

6 participants