Implemented function to measure performance on various datasets