Created
April 1, 2015 17:13
-
-
Save a-milogradov/66e0359bd3c75ccc442c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EZschedule tests | |
All data generated with random data | |
# Number of objects: | |
In [95]: Complex.objects.count() | |
Out[95]: 1000 | |
In [96]: Facility.objects.count() | |
Out[96]: 6500 | |
In [97]: FacilityType.objects.count() | |
Out[97]: 30 | |
In [98]: Booking.objects.count() | |
Out[98]: 1999729 | |
# Results of some trial lookups | |
In [120]: %timeit Booking.objects.filter(facility=random_instance(Facility)).count() | |
10 loops, best of 3: 42.9 ms per loop | |
In [125]: %timeit list(Booking.objects.filter(facility__facility_type=random_instance(FacilityType))) | |
1 loops, best of 3: 585 ms per loop | |
In [127]: %timeit list(Booking.objects.filter(facility__facility_type=random_instance(FacilityType)).filter(start_time__gt=datetime.datetime.now().date()).filter(facility__complex__name__icontains='awq')) | |
100 loops, best of 3: 2.77 ms per loop | |
In [117]: %timeit Booking.objects.filter(facility__facility_type=random_instance(FacilityType)).filter(facility__complex__name__icontains='a').filter(Q(facility__name__icontains='v') | Q(facility__name__icontains='s')).filter(end_time__lt=datetime.datetime.now().date() + datetime.timedelta(days=30)).extra(where=[''' extract(hour from "bookings_booking"."start_time") > 3''']).count() | |
1 loops, best of 3: 580 ms per loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment