Ticket #2532236 (closed enhancement)

Reporter


nuria
Opened: 05/1/12
Last modified: 08/1/12
Status: closed
Type: enhancement
Resolution: fixed

Owner


Dav Glass
Target Release: 3.6.0
Priority: P3 (normal)
Summary: Performance problems on YUI().use on FF3.6 and IE8
Description:

We have recently upgraded YUI to its latest version to find that for FF 3.6 and IE8 is much slower to call YUI().use than it was on YUI3.4. We are aware that there is functionality on 3.5 that did not
existed on 3.4 but still the perforamnce penalty in those browsers is too high.

The problem comes with the _inspectPage method in the YUI object. This method builds everytime the instance is called the dependency tree, there is no caching whatsoever among instances. As far as I
know there are two possible methods to load dependencies in YUI:

1) Use YUI().use('whatever-module')
2) Load JS directly with a "script" tag.

There is no method to remove dependencies, then, it seems that caching of what has been already loaded should happen across YUI instances. If a module is loaded is loaded "for ever", thus why do we
need to rebuild the dependency tree everytime from scratch when the YUI instance is found?

Type: enhancement Observed in Version: 3.5.0
Component: Loader Severity: S3 (normal)
Assigned To: Dav Glass Target Release: 3.6.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: Firefox 3.x - All,IE 8.x
URL:
Test Information:

Change History

Dav Glass

Posted: 05/1/12
  • component changed from None to Loader
  • location changed to Library Code
  • milestone changed to 3.6.0
  • owner changed from Jenny Donnelly to Dav Glass
  • priority changed to P3 (normal)
  • status changed from infoneeded to assigned
  • type changed from defect to enhancement

Dav Glass

Posted: 05/1/12

I'll look into this, but I asked for a repro case. My tests all execute in a normal time frame in all browsers that I test against. I'm not seeing this dramatic "slow down", so please attach a repro case not an explaination of the code.

nuria

Posted: 05/1/12

I think executing YUI.use about , say, 20 times in each browser is sufficient. Not the same 'use' but rather 20 different YUI.use in sequence. Like

YUI.use('module-1',function (Y){//does something});

YUI.use('module-2',function (Y){//does something});
...

YUI.use('module-20',function (Y){//does something});

Our YUI config is like this:

{"cdn":"http://static.tuenti.com/?","base":"http://static.tuenti.com/?","comboBase":"http://static.tuenti.com/?","combine":true,"root":"","filter":"min","lang":"es-ES"}

Dav Glass

Posted: 05/1/12
  • status changed from assigned to accepted

Dav Glass

Posted: 05/1/12

So you're creating 20+ YUI instances in your application? We don't specifically test that use case because it's not recommended and totally not performant and never will be. You should limit your instances to as few as possible, not only for performance but from a memory standpoint alone. A YUI instance costs memory when created, so when you create dozens you are just asking for your own trouble.

I will investigate this issue, but it's not a high priority since it's not a recommended practice and never was intended to be used in this fashion.

nuria

Posted: 05/1/12

We do YUI().use about 20 times more or less and I understand that this is not your base use case but regardless, once modules have loaded they cannot be "unloaded" so it seems that it will be worth it to have a static cache of modules loaded that the instances share.

Dav Glass

Posted: 05/11/12
  • estimated changed from 0 to 0.5
  • remaining changed from 0 to 0.5
  • sprint changed to sprint 2

Dav Glass

Posted: 05/15/12
  • completed changed from 0 to 0.5
  • remaining changed from 0.5 to 0

Dav Glass

Posted: 05/15/12
  • resolution changed to fixed
  • status changed from accepted to checkedin

Fixes #2532236 - Added caching to isCSSLoaded

This enhancement shaves 3-4 seconds off the loader
test suite.
View Commit: 5d4201bce0adc2f08b907dde251c1e9bf18833ec

Jenny Donnelly

YUI Developer

Posted: 08/1/12
  • status changed from checkedin to closed

Shipped in 3.6.0. Marking closed/fixed.