billiard.Pool slower than multiprocessing.Pool
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- backend, performance
Research direction
Start by running the reported benchmark comparing billiard.Pool with multiprocessing.Pool on the pandas and numpy workload shown in the issue. Trace the source of the slowdown and document or fix the discrepancy; done means the comparison is explained or corrected while the resulting data still matches.
Written by the indexing model from the issue text.
Description
import pandas as pd
import time
import numpy as np
def aa(df):
df_c = df.copy()
df_c['C'] = df_c['A'] + df_c['B']
return df_c
def using_multiprocessing(df, func, n_cores=4):
from multiprocessing import Pool
df_split = np.array_split(df, n_cores)
pool = Pool(n_cores)
start_time = time.time()
df = pd.concat(pool.map(func, df_split))
pool.close()
pool.join()
print(f"Using multiprocessing {time.time() - start_time}")
return df
def using_billiard(df, func, n_cores=4):
import billiard
df_split = np.array_split(df, n_cores)
pool = billiard.Pool(n_cores)
start_time = time.time()
df = pd.concat(pool.map(func, df_split))
pool.close()
pool.join()
print(f"Using billiard {time.time() - start_time}")
return df
inp = pd.DataFrame(np.random.randint(0,1000000,size=(1000000, 2)), columns=list('AB'))
df_1 = using_multiprocessing(inp, aa, 5)
df_2 = using_billiard(inp, aa, 5)
print(df_1.equals(df_2))
I got output:
Using multiprocessing 0.2115309238433838
Using billiard 31.323524951934814
True
- Dominant language
- Python
- Stars
- 436
- Forks
- 273
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 5
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from celery/billiard
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
return in finally can swallow exceptionsMay be free again @auvipy claimed this 602 days ago, and no pull request is open. Open
celery/billiard#414 · 6 comments · 3 reactions · 1 assignee ·
-
Handling numpyOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
AI bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
btclib-org/btclib-wallet#872 ·
Maintainers usually reply within 1 day
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme loadPossibly taken A pull request linked to this issue is open or already merged. Openbug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
saltstack/salt#70789 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 87/100
btclib-org/btclib#3093 ·
Maintainers usually reply within 1 day