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

.drop_duplicates() works much slower on Modin than on Pandas #5554

Closed
Tracked by #5612
dchigarev opened this issue Jan 18, 2023 · 0 comments · Fixed by #5587
Closed
Tracked by #5612

.drop_duplicates() works much slower on Modin than on Pandas #5554

dchigarev opened this issue Jan 18, 2023 · 0 comments · Fixed by #5587
Labels
Performance 🚀 Performance related issues and pull requests.

Comments

@dchigarev
Copy link
Collaborator

dchigarev commented Jan 18, 2023

Modin's .drop_duplicates implementation works approximately 10x-100x times slower than pandas. We'd like to find some room for improvement here.

import modin.pandas as pd
import pandas
import numpy as np
import timeit

NROWS = 1_000_000
RAND_LOW = 0
RAND_HIGH = 10_000_000

data = {
    "col0": np.tile(
        np.concatenate([np.random.randint(RAND_LOW, RAND_HIGH, NROWS // 100 - 1), [1]]),
        100,
    ),
    "col1": np.tile(
        np.concatenate([np.random.randint(RAND_LOW, RAND_HIGH, NROWS // 100 - 1), [1]]),
        100,
    ),
}

md_df = pd.DataFrame(data)
pd_df = pandas.DataFrame(data)

# drop_duplicate: 
#   input_shape = (1_000_000, 2)
#   output_shape = (10_000, 2)

NRUNS = 5
md_res = timeit.timeit(lambda: md_df.drop_duplicates(), number=NRUNS)
pd_res = timeit.timeit(lambda: pd_df.drop_duplicates(), number=NRUNS)

print(f"Cumulative time of {NRUNS} runs for modin: {md_res}s.") # ~10s.
print(f"Cumulative time of {NRUNS} runs for pandas: {pd_res}s.") # ~0.3s

We may use this issue as an epic to reference all of the perf problems with .drop_duplicates()

@dchigarev dchigarev added Performance 🚀 Performance related issues and pull requests. Epic labels Jan 18, 2023
YarShev added a commit to YarShev/modin that referenced this issue Jan 27, 2023
…ted`

Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
@dchigarev dchigarev removed the Epic label Feb 2, 2023
dchigarev pushed a commit that referenced this issue Feb 2, 2023
Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
Co-authored-by: Anatoly Myachev <anatoliimyachev@mail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance 🚀 Performance related issues and pull requests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant