diff --git a/pyperformance/data-files/benchmarks/MANIFEST b/pyperformance/data-files/benchmarks/MANIFEST index 63760823..05e1bf5e 100644 --- a/pyperformance/data-files/benchmarks/MANIFEST +++ b/pyperformance/data-files/benchmarks/MANIFEST @@ -14,6 +14,7 @@ generators chameleon chaos crypto_pyaes +dask deepcopy deltablue django_template diff --git a/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml b/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml new file mode 100644 index 00000000..747fb2f2 --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_dask/pyproject.toml @@ -0,0 +1,9 @@ +[project] +name = "pyperformance_bm_dask" +requires-python = ">=3.8" +dependencies = ["pyperf"] +urls = {repository = "https://github.com/python/pyperformance"} +dynamic = ["version"] + +[tool.pyperformance] +name = "dask" diff --git a/pyperformance/data-files/benchmarks/bm_dask/requirements.txt b/pyperformance/data-files/benchmarks/bm_dask/requirements.txt new file mode 100644 index 00000000..374cf38a --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_dask/requirements.txt @@ -0,0 +1 @@ +dask[distributed]==2022.2.0 diff --git a/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py b/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py new file mode 100644 index 00000000..cf6610d2 --- /dev/null +++ b/pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py @@ -0,0 +1,31 @@ +""" +Benchmark the Dask scheduler running a large number of simple jobs. + +Author: Matt Rocklin, Michael Droettboom +""" + +from dask.distributed import Client, Worker, Scheduler, wait + +import pyperf + + +def inc(x): + return x + 1 + + +async def benchmark(): + async with Scheduler() as scheduler: + async with Worker(scheduler.address): + async with Client(scheduler.address, asynchronous=True) as client: + + futures = client.map(inc, range(100)) + for _ in range(10): + futures = client.map(inc, futures) + + await wait(futures) + + +if __name__ == "__main__": + runner = pyperf.Runner() + runner.metadata['description'] = "Benchmark dask" + runner.bench_async_func('dask', benchmark)