garious/icontrib — Issue #23: revert yoink to unordered interpreting
Author: garious
Created: 2012-01-18 18:46:13+00:00
State: open

Bad:
~~~javascript
define(['jquery.js', 'jquery-plugin.js'], function($, P) {
...
});
~~~

Better:
~~~javascript
define(['jquery-plugin-mod.js'], function(PLUG) {
return {
deps: ['jquery.js'],
callback: function($) {
PLUG.thrustSelfUponThee($);
...
};
}
};
~~~

Painful for jquery plugins, true, but will get much better performance for everyone that doesn't utilize jquery's awkward plugin model. The former only works because:

1) jQuery first writes to global variables, which the plugin uses to thrust itself into the jQuery object
2) yoink jumps through hoops to download modules in parallel but then interpret them in sequence.

instead, yoink will go back to interpreting modules as soon as it receives them, which will allow it to start downloading its own dependencies as quickly as possible instead of waiting for the slowest download to complete.