gregplaysguitar / django-next-prev

Django utility to retrieve the next or previous object, given a current object and a queryset.
Other
25 stars 5 forks source link

Replace slow `not qs` operation. #11

Closed jablkoj closed 3 years ago

jablkoj commented 3 years ago

not qs can be very slow for large querysets.

I tested calling prev_in_order(sample, qs=Sample.objects.all()) with 16000 Samples and it took 200-500ms while the rest of next_or_prev_in_order function took less than 10ms. (Django==3.0.6; django-next-prev==1.0.1)

gregplaysguitar commented 3 years ago

Huh, thanks for this, so is not qs actually evaluating the queryset?