Core i7 is not always faster than i5

I always thought of Intel Core i7 as the best and the fastest compared to Intel Core i5. That is why when I saw computer specifications with Core i7 processor looks wow compared to Core i5 and sometimes it become justifiable for a more expensive price. Few moments ago I conclude that this is not a right opinion. The number of core and clockspeed have more impact on performance compared to processor series or architectures.