Replies: 2 comments 4 replies
-
I did some experiments with Here is some test code and result:
console.clear();
function build_blank(n) {
var ret = '1';
for (var i = 0; i < n; i++) {
ret += ' ';
}
return ret + '1';
}
// console.log(t, R);
var time = Date.now();
t.trim(build_blank(50000));
var time_cost = Date.now() - time;
console.log('time_cost: ' + time_cost);
var time2 = Date.now();
build_blank(50000).trim();
var time_cost2 = Date.now() - time2;
console.log('time_cost2: ' + time_cost2); result:
console.clear();
function build_blank(n) {
var ret = '1';
for (var i = 0; i < n; i++) {
ret += ' ';
}
return ret + '1';
}
// console.log(t, R);
var time = Date.now();
R.trim(build_blank(50000));
var time_cost = Date.now() - time;
console.log('time_cost: ' + time_cost);
var time2 = Date.now();
build_blank(50000).trim();
var time_cost2 = Date.now() - time2;
console.log('time_cost2: ' + time_cost2); result:
|
Beta Was this translation helpful? Give feedback.
-
I cannot confirm it, to trim a 50.000.000 char string on our 2013 Macbook , Chrome takes Makes sure you don't include the string generation in your time measurements. Edit 2.6.2022 |
Beta Was this translation helpful? Give feedback.
-
@customcommander, @adispring, @kedashoe, @semmel:
Anyone have an idea why #3177 is back? We're getting reports about it.
I would just dismiss it out of hand, as this:
runs in a few milliseconds in Node, under
0.27.2
, under0.28.0
, and underlatest
npm installs.But it seems to be still a problem in the REPL, taking around three seconds for me. It's hard to tell with the minimized code if the regex character removed is still missing, but the other tweak in the relevant commit is still there, so I assume it is.
I'm confused. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions