Skip to end of metadata
Go to start of metadata

Project goals

  • Investigate on the web best practices for optimizing pages for low bandwidth
  • Minimize the number of AJAX urls that need to be loaded in certain workflows
  • If possible make AJAX call in parallel rather than sequential
  • use javascript/css aggregation
  • Optimize currently used images/icons:
    • compress images
    • remove unwanted / missing image references in css
    • use image sprites
    • use png /gif instead of jpg format
  • Restructure html layout
    • Use div's etc instead of nested tables ( especially public pages like contribution, event and profiles )
    • Delete commented code / unnecessary spaces in templates
  • Optimize current javascript function
    • lot of functions currently use native javascript which is can be optimize using jquery functions.

Already Done

  • CRM-9581 cleanup/ optimize various js functions
  • make sure all the js files are compressed.
  • Check and make sure css / js is loaded from separate civicrm website.
  • CRM-9765 load heavy js files like wyswyg editor on demand

Findings

  • You can load css / js from separate civicrm website. So basically you can have a civicrm instance which is not public and load css/js from public instance.
    • For this you will need to modify civicrm.module and fix the path for js / css to load it from external site. For eg:

      Index: drupal/civicrm.module
      ===================================================================
      --- drupal/civicrm.module (revision 38714)
      +++ drupal/civicrm.module (working copy)
      @@ -59,13 +59,13 @@
      continue;
      }
      if ( strpos( $line, '.js' ) !== false ) {
      - drupal_add_js( drupal_get_path('module', 'civicrm' ) . '/../' . $line, array(
      + drupal_add_js( '<external website url>' . $line, array(
      'group' => JS_LIBRARY,
      'weight' => 10,
      'scope' => 'header',
      ) );
      } else if ( strpos( $line, '.css' ) !== false ) {
      - drupal_add_css( drupal_get_path('module', 'civicrm' ) . '/../' . $line );
      + drupal_add_css( '<external website url>' . $line );
      }
      }

Assumptions / Things you should do

  • Turn on js/css aggregation in Drupal Performance Settings
  • Ensure you are running apache2 with mod_deflate (compression) and mod_expires
  • If you are hosting js/css externally ensure that site is also using  mod_deflate (compression) and mod_expires
  • Use memcached with CiviCRM to reduce load on the database

Hours

  • Research - 5 hours
  • Development - 15 hours
Labels
  • None
  1. Jan 10, 2012

    On some pages it has seemed to me that a large number of jQuery files were being loaded separately. I'm not even sure if all of them could be invoked on the page. If possible, integrate file aggregation into CMS's, since the base CMS page may also be using the same jQuery files as CiviCRM.

  2. Feb 07, 2012

    Might it be possible to strip comments out of js and tpl's at time of tarball creation, so that documentation isn't lost?

     


Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.