// replace function
var replace = function(pattern, replacement) {
- var start = new Date().getTime();
- data = data.replace(pattern, replacement);
- var end = new Date().getTime();
+ if (true) {
+ data = data.replace(pattern, replacement);
+ } else { // for debugging purposes only
+ var start = new Date().getTime();
+ data = data.replace(pattern, replacement);
+ var end = new Date().getTime();
- if (false && end > start) {
- sys.print(pattern);
- sys.print(' -> ');
- sys.print(end - start);
- sys.print(' milliseconds\n');
+ if (end > start)
+ sys.print(pattern + ' -> ' + (end - start) + ' milliseconds\n');
}
};