slow javacript

slow javacript

by Matti Jordman -
Number of replies: 5

Hi

I use a self-made and quite large javascript activity module on moodlemusic.net.

The development of this module has been quite difficult due to the ever-changing environment. There was a lot of effort with AMD, and I think ES6 is the next effort.

After all this work, the module always runs only slower. This is quite frustrating.

I have also done LTI module using the exact same code (music4lms.fi). It allows me to easily add external LTI functionality to Moodle (and other platforms), and it works incredibly much faster than the Moodle module as well.

It is sad to stop developing this Moodle module, but I don’t see enough reasons to continue developing it. Or can we expect faster JavaScript for Moodle in the near future?

matti

Average of ratings: -
In reply to Matti Jordman

Re: slow javacript

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
This is very surprising to me. If you had asked me to guess, I would have predicted the opposite: I would expect modern JavaScript to be master than something using jQuery or YUI.

Are you seeing this in all browsers? Have you made any attempt to quantify how much slower it is.

I think Modern browsers include tools to profile the JS. I have never tried to use them (because I have never coded anything complicated enough, and the slow bit is always obviously the AJAX calls back to Moodle). Those might help work out where and why it is slow.
In reply to Tim Hunt

Re: slow javacript

by Matti Jordman -

Here's some loading times, seconds:

chrome

  • lti module 2 s
  • moodle module c. 12 s

edge

  • lti module 1 s
  • moodle module c. 8 s

firefox

  • lti module 2 s
  • moodle module c. 4 s

So far I have recommended the use of Chrome, but maybe not any more. Has anyone else had any Moodle+Chrome+Javascript problems?


In reply to Matti Jordman

Re: slow javacript

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I think we would need to know a bit more about the actual implementation to be able to interpret these times correctly. You are comparing "LTI module" with "Moodle module". What exactly do you mean by those? Moodle activity? If so, how does it integrate the JavaScript? And what exactly do you mean by the "LTI module"? And where are these hosted and how they are loaded into the browser? Is the code for all these available somewhere?

In reply to David Mudrák

Re: slow javacript

by Matti Jordman -
Here's a test course: https://moodlemusic.net/fi/course/view.php?id=151
Log in using demouser/demouser
I'd choose for this comparison an exercise type that is really slow in Moodle, not all are. The integration is probably not the problem because many exercise types are ok.
Moodle module is self made acitivity module. LTI module is tsugi module loaded from music4lms.fi
Not open source. Thanks for any help.
In reply to Matti Jordman

Re: slow javacript

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Or can we expect faster JavaScript for Moodle in the near future?

I agree with Tim. Moodle can be blamed for many things, but hardly for ever-changing JavaScript or its performance. Moodle is actually more and more getting rid of additional layers and heavy framework libraries and the recommended approach is to use vanilla ES6 features.

Average of ratings: Useful (1)