Created
May 24, 2011 05:53
-
-
Save getify/988188 to your computer and use it in GitHub Desktop.
comparing LABjs and $script.js when parallel loading with execution order dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="../vendor/lab2.min.js"></script> | |
<script type="text/javascript"> | |
var start = (+new Date); | |
// load some scripts dependent on each other (in parallel but preserving execution order) | |
$LAB | |
.setOptions({AlwaysPreserveOrder:true}) | |
.script('a.js') | |
.script('b-needs-a.js') | |
.script('c-needs-b.js') | |
.wait(function(){ | |
a() + b() + c(); | |
// benchmark time! | |
document.getElementById('total').innerHTML = (+new Date) - start; | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="../dist/script.js"></script> | |
<script type="text/javascript"> | |
var start = (+new Date); | |
// load some scripts dependent on each other (as nested $script calls, so NOT parallel) | |
$script('a.js',function(){ | |
$script('b.js',function(){ | |
$script('c.js',function(){ | |
a() + b() + c(); | |
// benchmark time! | |
document.getElementById('total').innerHTML = (+new Date) - start; | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
previous comparison with more identical syntax/scenario:
https://gist.github.com/e387c1d63656418db6aa