test Join and Split

Benchmark created by Luigi on


Preparation HTML

<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>

Test runner

Ready to run.

Testing in
TestOps/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);
});
ready
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);
});
ready

Revisions

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

  • Revision 1: published by Luigi on
  • Revision 8: published by Julian Dicks on
  • Revision 9: published by Julian Dicks on