Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyperformance/data-files/benchmarks/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ generators <local>
chameleon <local>
chaos <local>
crypto_pyaes <local>
dask <local>
deepcopy <local>
deltablue <local>
django_template <local>
Expand Down
9 changes: 9 additions & 0 deletions pyperformance/data-files/benchmarks/bm_dask/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dask[distributed]==2022.2.0
31 changes: 31 additions & 0 deletions pyperformance/data-files/benchmarks/bm_dask/run_benchmark.py
Original file line number Diff line number Diff line change
@@ -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 async generators"
runner.bench_async_func('dask', benchmark)