-
Notifications
You must be signed in to change notification settings - Fork 12.8k
In ts.performance.now, bind window.performance.now #9956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Using an arrow function. Previously, it was set directly to window.performance.now, which fails when used on Chrome.
Incidentally, I ripped off |
👍 It's always a little disappointing how inconsistent the web is with what you can rip off its hosting object and what you cannot. |
And neither |
@sandersn That was why I thought it was okay to rip both off. 😞 |
One of the Mac builds timed out. I think it's OK to merge anyway. |
@sandersn This has been happening every few builds - I actually restarted a build last night that had been running for over an hour (I just assumed travis had hung). I don't know if it's a random pathological perf problem in TS that's only exposed on mac, or an issue with the travis infrastructure. |
FYI: compared Don't have an Edge to try. Here's the code below to run in DevTools console: var runAndAgain = function() {
setTimeout(function() {
runMillion();
runAndAgain();
}, 1);
};
runAndAgain();
function runMillion() {
var now_arrow = function() { return performance.now(); };
var now_bind = performance.now.bind(performance);
var start = new Date(), tmp=0;
for (var i = 0; i < 1000000; i++) { tmp = now_arrow(); }
var arrow_time = new Date() - start;
var start = new Date(), tmp=0;
for (var i = 0; i < 1000000; i++) { tmp = now_bind(); }
var bind_time = new Date() - start;
console.log('arrow '+arrow_time+'\tbind '+bind_time+'\t ratio '+(((10000*arrow_time/bind_time)|0)/100)+'%');
} |
Does anybody use IE11 to debug TypeScript? Faster in Chrome is better in my book. |
AFAIK, most of the team doesn't use IE, so the faster in chrome/FF option does seem better. |
I totally agree, Chrome is a better target -- and the difference is small enough anyway. Only wanted to give more context 👍 |
Fixes #9954
Using an arrow function. Previously, it was set directly to window.performance.now, which fails when used in Chrome.