How to handle garbage collector delay?

I am doing some lengthy algo in javascript for a contest. I run it until reaching 80 ms and after produce an answer.
Some time, I get a timeout as if the last few lines takes more than 20ms. I really suspect the Garbarge collector ran just at this time and ruin the time calculation.
Do you know how to force the garbage collector run at a desired time?

1 Like