jeudi 22 janvier 2015

Performance differances between std::count and std::find

This might be a stupid question but I want to check a container (in this case an std::vector of bool but a broader approach would be better) to check if a value exist. As I understand both the run time std::count and std::find are linear and count might slower if the item is in the range but I think that both should be the same if the object exists, but I could see the probability that a complier could vectorize std::count and therefore making std::count run faster. Am I correct with the first assumption that both will run the same or is the second assumption that compliers can vectorize std::count true?


Aucun commentaire:

Enregistrer un commentaire