test Join and Split

JavaScript performance comparison

Test case created by Luigi

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.3/mootools-yui-compressed.js"></script>

<span id="bigText">
Contrary to popular belief, Lorem Ipsum is not simply random text. dog It has roots in a dog piece of classical Latin literature from 45 BC, making it over 2000 cat years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum dog passage, and going through the cites of the word in classical literature, cat discovered the dog undoubtable source. Lorem cat Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, cat written in 45 BC. This book is a treatise on the theory of ethics, cat very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s is 
reproduced below for those dog interd. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et cat Malorum" by Cicero are also dog reproduced in their exact original form, accompanied by cat English versions from the cat 1914 translation by H. Rackham.</span>
    

Preparation code output

<span id="bigText"> Contrary to popular belief, Lorem Ipsum is not simply random text. dog It has roots in a dog piece of classical Latin literature from 45 BC, making it over 2000 cat years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum dog passage, and going through the cites of the word in classical literature, cat discovered the dog undoubtable source. Lorem cat Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, cat written in 45 BC. This book is a treatise on the theory of ethics, cat very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those dog interd. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et cat Malorum" by Cicero are also dog reproduced in their exact original form, accompanied by cat English versions from the cat 1914 translation by H. Rackham.</span>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
replace
window.addEvent('domready', function() {
var target = $('bigText');
var text = target.get('html');
var replaces = {
cat : 'fish',
dog : 'mouse'
}
Object.each(replaces, function(value, key){
text = text.replace(new RegExp(key, 'g'), value);
});
target.set('html', text);
});
pending…
split join
window.addEvent('domready', function() {
var target = $('bigText');
var text = target.get('html');
var replaces = {
cat : 'fish',
dog : 'mouse'
}
Object.each(replaces, function(value, key){
text = text.split(key).join(value);
});
target.set('html', text);
});
pending…

Compare results of other browsers

Revisions

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

0 Comments

Contrary to popular belief, Lorem Ipsum is not simply random text. dog It has roots in a dog piece of classical Latin literature from 45 BC, making it over 2000 cat years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum dog passage, and going through the cites of the word in classical literature, cat discovered the dog undoubtable source. Lorem cat Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, cat written in 45 BC. This book is a treatise on the theory of ethics, cat very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those dog interd. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et cat Malorum" by Cicero are also dog reproduced in their exact original form, accompanied by cat English versions from the cat 1914 translation by H. Rackham.