itervsjoin

JavaScript performance comparison

Test case created by SomeKittens

Info

Is it better to iterate over a

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var ret = '';
    var styles = [
    '<link rel="stylesheet" type="text/css" href="/link/to/stylesheets.css">',
    '<link rel="stylesheet" type="text/css" href="/link/to/stylesheets.css">',
    '<link rel="stylesheet" type="text/css" href="/link/to/stylesheets.css">',
    '<link rel="stylesheet" type="text/css" href="/link/to/stylesheets.css">'
    ];
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
iter
for (var i in styles) {
        ret += styles[i] + '\n';
}
pending…
join
ret = styles.join('\n')
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment