Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Dask benchmark #246

Merged
merged 4 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all 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 dask"
runner.bench_async_func('dask', benchmark)