Reduce CPU Usage when Executing JS in Browser

I’m trying to do the Sudoku Solver project, and as expected, the recursive backtracking algorithm is very computationally intensive. When executing this, it uses a large amount of CPU, and seems to crash or freeze up before the solution can be reached:

Is there any way to execute JavaScript in a slower, but less intensive way within the browser?

Whoops! The problem was actually caused by console logging a nested array in each iteration of the algorithm. After I stopped doing this, it ran fairly quickly and didn’t slow down.

2 Likes