Please create the filter at the beginning, and then reuse it. We found when profiling that only with this change, we were saving around ~4 seconds when deleting 100 threads, and it was one of the key points for decreasing the deletion time.
Here you have the change https://github.com/mozilla-b2g/gaia/pull/10841#discussion_r5117342