The editor loads extremely slow - like 2-4 seconds for the text to appear, and often the browser says unresponsive script. All other stuff runs great and fast on my linode server. Anyone knows what can cause this slowness. Tried both with tinymce and ckeditor.

Comments

TwoD’s picture

Status: Active » Postponed (maintainer needs more info)

Which browser(s) are the editors slow in?
Does it happen even on new nodes where there's no content yet?
Are you using any other JavaScript-heavy modules or libraries?
If you check the network tabs in tools like Firebug for Firefox, the developer tools for Chrome (Ctrl+Shift+J) (might need to set up a local proxy like Fiddler2 for IE to debug this) you should be able to see when each file is requested, when the response begins to arrive and when it's rendered and done. That should give clues on which files are problematic.

The editors will of course take a longer time to load on the first run since the browser cache isn't used yet. If you use Boost module, a CDN, Varnish, or other caching tools you might need to tweak it a bit if they don't serve you the same cached version on subsequent requests - forcing the browser to re-download everything each time.

When the browser says "unresponsive script" it can be any script on the page holding others up, as they don't run in parallel. Some debug tools have script profiling tools which you can enable to run when the page is loaded and then stop when everything is done. The report will list in which functions most time was spent, how many times they were called and so on. Output from a profiling run would be very helpful in determining what takes so long.

jojonaloha’s picture

Status: Postponed (maintainer needs more info) » Active

I'm experiencing similar issues. So far it's only been in Firefox and interestingly only for a certain role. I can use another role which has access to the same text format, without issues.

I'm not very experienced in profiling javascript, but there are a couple things I've done that will hopefully help others as a starting point.

First thing I did was add some console.log() to see where it started becoming unresponsive. It got through "Drupal.wysiwygInit()", it was in the first line of "Drupal.behaviors.attachWysiwyg.attach" that would not fire before the script became unresponsive. So my first thought was that the browser detection that is being used multiple times may be slow in Firefox?

Then I tried your suggestion of using Firebug's profiling, and the things that took the most time were jQuery.extend() (think that might be a given) and this bit of code

"if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, newName, name ) { "

Also, at one point Firefox prompted me to "Debug Code" instead of just "stop" or "continue" the script, and it looked like it was stopping on Drupal token stuff.

Sorry I'm not more help, but hopefully this gives some clues to somebody that is better at javascript then me.

TwoD’s picture

Hmm, I doubt the test for Konqueror is very expensive. It's just running a minimal Regular Expression over a small string, which should only happen when the page is first loaded, or when AJAX operations load new content.

Perhaps it took time before Drupal's behavior code was run at all. That might be noticed by also looking at things like expandable fieldsets. If they don't become expandable until after a while, it's a good indicator pretty much all scripts are waiting for something to happen or fire some lading event.

jQuery.extend() can be pretty heavy, but unless the settings structures have become massive, or you're using a ton of editors, it shouldn't be delaying things that long.

Since this seems to happen on just one role, try building a list of differences between a working role and the role with problems. Try to nail it down to whether certain modules or scripts are only running for the slow role and/or if some settings differ significantly. Are there different caching rules for the roles? Maybe one of them is loading compressed/minified versions of scripts and stylesheets while the other is loading raw sources?

TwoD’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

I'm closing this support request since I still can't reproduce the issue, and there's been no activity for a long time.
This is not to say optimizations aren't needed, just that this particular case is currently a very low priority.

If you are still experiencing performance problems when editors are loaded or [re-]attached, please reopen the issue and provide as much information about your browser (preferably with extensions disabled) and Drupal setup as possible.

lsolesen’s picture

This can be fixed by using token_tweaks.