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

Output SCSS compiled in compact form

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.2
    • Fix Version/s: 3.9.2
    • Component/s: Performance, Themes
    • Labels:
      None
    • Testing Instructions:
      Hide

      Output should be identical (ooh, just checked this and there's an extra Unicode BOM.

      /usr/bin/time -v php admin/cli/build_theme_css.php --themes=boost --direction=ltr

      Should report very slightly smaller memory usage (and time, though there's probably more random variation in that)

      Show
      Output should be identical (ooh, just checked this and there's an extra Unicode BOM. /usr/bin/time -v php admin/cli/build_theme_css.php --themes=boost --direction=ltr Should report very slightly smaller memory usage (and time, though there's probably more random variation in that)
    • Workaround:
      Hide

      It's entirely possible this has no noticeable impact, since there are later things that will rewrite the whole file.

      I will come back to this after checking out some other changes to see if there's a measurable difference still.

      Show
      It's entirely possible this has no noticeable impact, since there are later things that will rewrite the whole file. I will come back to this after checking out some other changes to see if there's a measurable difference still.
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE

      Description

      We have both a PHP and a command line (sassc/libsass) sass compiler. Both, by default, output in a semi-human readable form, but have simple options to change the output format:

      https://scssphp.github.io/scssphp/docs/#output-formatting

       

      or adding '-t compressed' for the sassc command line version.

      We should think about switching both to 'compressed' output, since we have a whole bunch of string manipluations done afterwards on the full CSS output, and the reduced size of this part may have a noticeable speed improvement as a result.

      I've not fully timed this yet, as it's complicated and I discovered this while looking at other stuff, but on the face of it there should be an easy improvement here and initial tests with the sassc mode suggest maybe a 1 or 2 second improvement, about 6-12% faster.

      The difference in the file size (measured in the middle of the process immediately after the SASS compilation is 1.1MB -> 978K or about 11% smaller

      Note that the multiple transformations done after this may mean there's no actual difference to the final output.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            bawjaws David Scotson
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Bas Brands
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Fix Release Date:
              14/Sep/20