Clears caches during benchmark to ensure the same conditions for each test.
This commit is contained in:
parent
da4e21b515
commit
ce9ec0c0a1
|
@ -161,6 +161,10 @@ class Benchmark(object):
|
|||
'cache': self.cache_name})
|
||||
|
||||
def benchmark(self, query_str, to_list=True, num_queries=1):
|
||||
# Clears the cache before a single benchmark to ensure the same
|
||||
# conditions across single benchmarks.
|
||||
caches[settings.CACHALOT_CACHE].clear()
|
||||
|
||||
self.query_name = query_str
|
||||
query_str = 'Test.objects.using(using)' + query_str
|
||||
if to_list:
|
||||
|
|
|
@ -23,6 +23,10 @@ Conditions
|
|||
|
||||
.. include:: ../benchmark/conditions.rst
|
||||
|
||||
Note that
|
||||
`MySQL’s query cache <http://dev.mysql.com/doc/refman/5.7/en/query-cache.html>`_
|
||||
is active during the benchmark.
|
||||
|
||||
Database results
|
||||
................
|
||||
|
||||
|
|
Loading…
Reference in New Issue