speed and space calculations