summaryrefslogtreecommitdiff
path: root/testing/tests/perf/test_sqlcipher.py
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-08-29 00:05:45 -0300
committerVictor Shyba <victor.shyba@gmail.com>2016-08-29 12:26:24 -0300
commitd86831e4cd3e77f340618168528e62cf4dafb5d7 (patch)
treed5491c9ec432729d41c177d9753c80e7598046e2 /testing/tests/perf/test_sqlcipher.py
parent49d4013819733966c05178254725e6a89f1909fe (diff)
[test] randomize payload
We were using 'x'*size as payload, but on real usage the payload will be random. This commit randomizes the payload using a predefined seed, so the random payload will be the same across benchmarks. Using random payloads also improves accuracy of compression or encoding impacts and we will be evaluating those changes for resouce usage issues. Also note that base64 is used on payload. That was needed for utf8 safety, but overhead was removed to leave payloads as defined by benchmarks. Base64 was chosen also due its popular usage on MIME encoding, which is used on mail attachments (our current scenario).
Diffstat (limited to 'testing/tests/perf/test_sqlcipher.py')
-rw-r--r--testing/tests/perf/test_sqlcipher.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/testing/tests/perf/test_sqlcipher.py b/testing/tests/perf/test_sqlcipher.py
index 1fce1c3e..e7a54228 100644
--- a/testing/tests/perf/test_sqlcipher.py
+++ b/testing/tests/perf/test_sqlcipher.py
@@ -6,9 +6,8 @@ import pytest
from twisted.internet.defer import gatherResults
-def load_up(client, amount, size, defer=True):
- content = 'x'*size
- results = [client.create_doc({'content': content}) for _ in xrange(amount)]
+def load_up(client, amount, payload, defer=True):
+ results = [client.create_doc({'content': payload}) for _ in xrange(amount)]
if defer:
return gatherResults(results)
@@ -16,17 +15,17 @@ def load_up(client, amount, size, defer=True):
def build_test_sqlcipher_async_create(amount, size):
@pytest.inlineCallbacks
@pytest.mark.benchmark(group="test_sqlcipher_async_create")
- def test(soledad_client, txbenchmark):
+ def test(soledad_client, txbenchmark, payload):
client = soledad_client()
- yield txbenchmark(load_up, client, amount, size)
+ yield txbenchmark(load_up, client, amount, payload(size))
return test
def build_test_sqlcipher_create(amount, size):
@pytest.mark.benchmark(group="test_sqlcipher_create")
- def test(soledad_client, benchmark):
+ def test(soledad_client, benchmark, payload):
client = soledad_client()._dbsyncer
- benchmark(load_up, client, amount, size, defer=False)
+ benchmark(load_up, client, amount, payload(size), defer=False)
return test