-
Notifications
You must be signed in to change notification settings - Fork 673
Open
Labels
P2Minor bugs or low-priority feature requestsMinor bugs or low-priority feature requestsPerformance 🚀Performance related issues and pull requests.Performance related issues and pull requests.
Description
Describe the problem
We recompute both column and row indices for column-wise and row-wise applies of user-defined callables and dict-like functions. Here for dict applies and here for callable applies, we specify neither new_index nor new_columns so we end up recomputing both axes, so we always block on both the first row of partitions and the first column of partitions. You can observe this unnecessary blocking here:
import modin.pandas as pd
import numpy as np
import time
from modin.config import MinPartitionSize
num_columns = MinPartitionSize.get() + 1
# 3 rows where each row has the numbers from 0 through num_columns
# exclusive in sequential order
# so the entire frame has a single row of two partitions,
# where the first has num_columns - 1 columns and the second has one.
df = pd.DataFrame(np.tile(np.arange(num_columns), (3, 1)))
# This takes hours for the the column containing 32,
# but should return much faster for the other columns.
def col_func(col):
if col[0] == num_columns - 1:
time.sleep(10000)
return col * 2
# This blocks on the last column to recompute
# the column index, so it blocks 10000 seconds.
# instead, it should finish immediately while the last
# apply completes asynchronously.
print('starting apply...')
result = df.apply(col_func)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Minor bugs or low-priority feature requestsMinor bugs or low-priority feature requestsPerformance 🚀Performance related issues and pull requests.Performance related issues and pull requests.