[Documentation] Explain performance improvements
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- numpy, pandas, python
- Domain
- documentation, performance
Research direction
The issue does not name a documentation file; start by locating the existing SingleNodeExecutor usage documentation and compare it with the provided benchmark examples. Document the progression from repeated data loading to block allocation and init_function-based loading, including the stated performance results and usage patterns.
Written by the indexing model from the issue text.
Description
Generate data:
import numpy as np
import pandas as pd
N = 1_000_000
data = pd.DataFrame({
"c": np.random.choice(["a", "b", "c"], size=N),
"x": np.random.uniform(size=N),
"y": np.random.normal(size=N)
})
data.to_csv("blob.csv") # File is about 45 Mb
Slow execution: 24.1 s ± 115 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
import numpy as np
import pandas as pd
from executorlib import SingleNodeExecutor
def get_sum(i, df):
return i, df["x"].sum(), df["y"].sum()
with SingleNodeExecutor(max_workers=10) as exe:
future_lst = [exe.submit(get_sum, df=pd.read_csv("blob.csv"), i=i) for i in range(100)]
result_lst = [f.result() for f in future_lst]
Reduce the startup time for the processes: 19.5 s ± 31.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
import numpy as np
import pandas as pd
from executorlib import SingleNodeExecutor
def get_sum(i, df):
return i, df["x"].sum(), df["y"].sum()
with SingleNodeExecutor(max_workers=10, block_allocation=True) as exe:
future_lst = [exe.submit(get_sum, df=pd.read_csv("blob.csv"), i=i) for i in range(100)]
result_lst = [f.result() for f in future_lst]
Load the data only once for each process: 946 ms ± 24.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
import numpy as np
import pandas as pd
from executorlib import SingleNodeExecutor
def get_sum(i, df):
return i, df["x"].sum(), df["y"].sum()
def init_funct():
return {"df": pd.read_csv("blob.csv")}
with SingleNodeExecutor(max_workers=10, block_allocation=True, init_function=init_funct) as exe:
future_lst = [exe.submit(get_sum, i=i) for i in range(100)]
result_lst = [f.result() for f in future_lst]
- Dominant language
- Python
- Stars
- 77
- Forks
- 7
- Avg merge
- 10h 32m
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
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 pyiron/executorlib
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pyiron/executorlib#1054 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pyiron/executorlib#1032 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pyiron/executorlib#1005 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
pyiron/executorlib#1049 · 1 comment ·
-
documentation
Difficulty 3/5 1-2 days Newbie friendliness 35/100
pyiron/executorlib#999 · 1 comment ·
All issues in pyiron/executorlib
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·