Performance improvements, especially with multiple threads