Efficient way to perform vector dot product

I wouldn’t open the champagne quite yet :slight_smile:
If there are a lot of terms which are present in many documents, then this approach might end up being slow, maybe even slower than your original take. But anyway, give it a try, and let us know how it went.