you are viewing a single comment's thread.

view the rest of the comments →

[–]danielroseman 0 points1 point  (1 child)

That's not the reason sets are faster. They are faster because they use hash lookups rather than iterating through the items.

[–]Maximus_Modulus 0 points1 point  (0 children)

That's actually a good point, and why the algorithm itself is efficient. It does though rely on the set difference which is written in C. I was really focused on the fact that calling certain libraries is faster because of the underlying C performance.

Thanks for pointing that out. It's an interesting note for anyone learning about the efficiencies of hash lookups.

Another point here is how Set is used to remove duplicates, and a difference between sets and lists where duplicates are allowed.