add some initial benchmarks
Co-Authored-By: holger krekel <holger@merlinux.eu>
This commit is contained in:
parent
c35e485510
commit
192238567b
@ -52,6 +52,7 @@ scripts/
|
||||
init.sh # create venv/other perequires
|
||||
deploy.sh # run pyinfra based deploy of everything
|
||||
test.sh # run all local and online tests
|
||||
bench.sh # run performance benchmark tests
|
||||
|
||||
```
|
||||
|
||||
|
34
online-tests/benchmark.py
Normal file
34
online-tests/benchmark.py
Normal file
@ -0,0 +1,34 @@
|
||||
def test_tls_serialized_connect(benchmark, imap_or_smtp):
|
||||
def connect():
|
||||
imap_or_smtp.connect()
|
||||
|
||||
benchmark(connect)
|
||||
|
||||
|
||||
def test_login(benchmark, imap_or_smtp, gencreds):
|
||||
cls = imap_or_smtp.__class__
|
||||
conns = []
|
||||
for i in range(20):
|
||||
conn = cls(imap_or_smtp.host)
|
||||
conn.connect()
|
||||
conns.append(conn)
|
||||
|
||||
def login():
|
||||
conn = conns.pop()
|
||||
conn.login(*gencreds())
|
||||
|
||||
benchmark(login)
|
||||
|
||||
|
||||
def test_send_and_receive_10(benchmark, cmfactory, lp):
|
||||
"""send many messages between two accounts"""
|
||||
ac1, ac2 = cmfactory.get_online_accounts(2)
|
||||
chat = cmfactory.get_accepted_chat(ac1, ac2)
|
||||
|
||||
def send_10_receive_all():
|
||||
for i in range(10):
|
||||
chat.send_text(f"hello {i}")
|
||||
for i in range(10):
|
||||
ac2.wait_next_incoming_message()
|
||||
|
||||
benchmark(send_10_receive_all)
|
4
scripts/bench.sh
Executable file
4
scripts/bench.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
online-tests/venv/bin/pytest online-tests/benchmark.py -vrx
|
@ -10,7 +10,7 @@ chatmaild/venv/bin/pip install pytest
|
||||
chatmaild/venv/bin/pip install -e chatmaild
|
||||
|
||||
python3 -m venv online-tests/venv
|
||||
online-tests/venv/bin/pip install pytest pytest-timeout pdbpp deltachat
|
||||
online-tests/venv/bin/pip install pytest pytest-timeout pdbpp deltachat pytest-benchmark
|
||||
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install build
|
||||
|
Loading…
Reference in New Issue
Block a user