My IDE runs tests slower when in a different workspace
It part of OS X itself to optimize the resources and to keep wise balance between foreground process and background tasks. Operating system devotes more resources to the active workspace, and to put less CPU processing capacity to the background tasks.

Benefits are obvious:


the higher responsiveness for user of the system in the overall for the foreground process;
and less CPU load (less heat is produced, CPU fan is quiet), lower impact on the battery life.


It should be clearly visible with Activity Monitor App, how much power system devotes to specific process.