Python Lists filter() vs List Comprehension – Which is Faster?
[Spoiler] Which function filters a list faster: filter() vs list comprehension? For large lists with one million elements, filtering lists with list comprehension is 40% faster than the built-in filter() method. To answer this question, I’ve written a short script that tests the runtime performance of filtering large lists of increasing sizes using the filter() … Read more