Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-56808

Javascript low performance when commiting

XMLWordPrintable

    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MOODLE_33_STABLE
    • master_MDL-56808
    • Moderate
    • Hide

      Run through some SCORM packages and make sure no "new" JavaScript errors occur, make sure grades are stored, interactions, completion status etc.

      A good one to test would be: "RunTimeMinimumCalls_SCORM12.zip" - from the mod/scorm/tests/packages directory.

      It would be very nice to be able to monitor JS performance and report any results - this should show a general improvement in SCORM api calls. (but also greatly improves readability of the code)

      Would be good to test AICC packages if possible (see MDLQA-8720 for an example test) and although we don't officially support SCORM 2004 it would be good to check no new issues occur.

      Show
      Run through some SCORM packages and make sure no "new" JavaScript errors occur, make sure grades are stored, interactions, completion status etc. A good one to test would be: "RunTimeMinimumCalls_SCORM12.zip" - from the mod/scorm/tests/packages directory. It would be very nice to be able to monitor JS performance and report any results - this should show a general improvement in SCORM api calls. (but also greatly improves readability of the code) Would be good to test AICC packages if possible (see MDLQA-8720 for an example test) and although we don't officially support SCORM 2004 it would be good to check no new issues occur.

      Hello all,

      I work for the CNED in France. They have a big Moodle platform with a lot of SCORM packages.

      Ultimately they have worked on a bunch of HTML5 SCORM 1.2 packages.

      All those package pages have navigation buttons at the bottom. When someone click on next or previous button, the package commit to save the progression, time, ... and load a new page.

      The packages have dizains of pages so the users navigate heavily between the pages. It has been reported to use that changing pages could take more than 5s on latest firefox or chrome. The performance issue being much more visible in Chrome.

      I first though it was a server performance problem but quickly understood that it wasn’t. The commit (POST to ajax_save_item.php) takes less than 300ms.

      I thus began to debug with the firefox javascript profiler.

      As you can see in my first screenshot (screenshot_scorm_wo_opti.png), it is the CollectData function in the scorm12.js that takes 32% of the execution time. And the most important, the other process won't begin while this one is not finished. The user has thus to wait 2 to 5 s to open the next page.

      We inspected the function and saw that it was calling a few eval. We thus simply replace those evals (like in the patch attached) and ran the profiler again.

      As you can see in the screenshot named screenshot_scorm_with_opti.png, the CollecData function doesn't appear anymore and the whole process is a lot faster. Use has now to wait less than a second.

      We have tested and tracking still seems to work. I think I didn't break anything but can't be sure.

      Question are :

      • Is there a reason for those eval in CollectData function?
      • Is it dangerous to replace them?

      Thanks in advance for your time.

      Bets regards.

      Noel Dieschburg

        1. scorm12.patch
          4 kB
        2. screenshot_scorm_with_opti.png
          screenshot_scorm_with_opti.png
          104 kB
        3. screenshot_scorm_wo_opti.png
          screenshot_scorm_wo_opti.png
          114 kB
        4. TEST_SCORM_CNED.zip
          7.43 MB

            danmarsden Dan Marsden
            ndieschburg Noel Dieschburg
            Dan Poltawski Dan Poltawski
            Andrew Lyons Andrew Lyons
            David Monllaó David Monllaó
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.