test Join and Split (v8)

Revision 8 of this benchmark created by Julian Dicks on


Preparation HTML

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

<span id="bigText">1,234,567,890.00.</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