5 | | In [5]: %timeit Skill() |
6 | | 6.05 µs ± 54.2 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) |
7 | | In [4]: %timeit for x in Skill.objects.all(): pass |
8 | | 156 ms ± 1.28 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 5 | In [5]: %timeit PersonSkill() |
| 6 | 8.9 µs ± 13 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) |
| 7 | In [2]: %timeit for x in PersonSkill.objects.all(): pass |
| 8 | 83 ms ± 628 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 9 | # skill is None for all objects |
| 10 | In [13]: %timeit for x in PersonSkill.objects.select_related('skill'): pass |
| 11 | 111 ms ± 446 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 12 | # skill is not None for all objects |
| 13 | In [10]: %timeit for x in PersonSkill.objects.select_related('skill'): pass |
| 14 | 187 ms ± 735 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |
12 | | In [2]: %timeit Skill() |
13 | | 5.78 µs ± 29.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) |
14 | | In [3]: %timeit for x in Skill.objects.all(): pass |
15 | | 149 ms ± 1.62 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 19 | In [18]: %timeit PersonSkill() |
| 20 | 8.54 µs ± 23.8 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each) |
| 21 | In [10]: %timeit for x in PersonSkill.objects.all(): pass |
| 22 | 75.1 ms ± 825 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 23 | # skill is None for all objects |
| 24 | In [5]: %timeit for x in PersonSkill.objects.select_related('skill'): pass |
| 25 | 108 ms ± 342 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |
| 26 | # skill is not None for all objects |
| 27 | In [7]: %timeit for x in PersonSkill.objects.select_related('skill'): pass |
| 28 | 178 ms ± 817 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) |