I'm facing a very strange behaviour with my application - if I start the profiler (must be JS profiler), the code works almost twice as fast.
I've reproduced it with a very simple code which can be found on this fiddle: https://jsfiddle.net/zagrwk44/
The thing is that this reproduces only on machines with old graphic cards. I've managed to reproduce it on a machine with AMD Radeon HD 6450 graphic card. On a newer machine this does not reproduce anymore.
How come the profiler makes the code run faster?? almost twice as fast!
The code that takes the time here is just changing the position of a div on the screen:
for (var i = 0; i < 1000000; i++) {
box.style.top = getRandomInt(0, 100) + '%';
box.style.left = getRandomInt(0, 100) + '%';
};
I'm starting and stopping the profiler via javascript with console.profile
and console.profileEnd
. In order to reproduce it, DevTools must be opened when running.
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…