Time difference between count and find

Revision en3, by Jbi, 2024-01-06 01:52:37

Hey cf ppl,

I was just wondering why set.count() works a lot faster than using vector.find(), from personal coding experience

This question seems to have already been answered on stack overflow, but it gave a what I thought as an incorrect answer, telling me that vector.find() would run faster than set.count() because it breaks as soon as it reaches the first occurence while set.count() would continually iterate through the whole array.

Thanks

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Jbi 2024-01-06 01:52:37 0 (published)
en2 English Jbi 2024-01-06 01:50:36 11 Tiny change: 'ering why many times set.count' -> 'ering why set.count' (saved to drafts)
en1 English Jbi 2024-01-06 01:50:04 506 Initial revision (published)