Detect number of CPU cores for faster testing

Faster tests are faster.