Sets use hashing for fast lookup. The difference is dramatic:
| Operation | List | Set |
|---|---|---|
| Check if element exists | time | time |
| Add element | time | time |
| Remove element | time | time |
For small collections, the difference doesn't matter. For large ones, it's huge.
# Checking 1000 items in a collection of 1,000,000
# List: 1000 * 1,000,000 = 1 billion operations
# Set: 1000 * 1 = 1000 operations
When you need fast membership testing (x in collection), use a set.