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

PERF-#7299: Avoid using synchronize_labels for combine function #7300

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

anmyachev
Copy link
Collaborator

@anmyachev anmyachev commented Jun 4, 2024

What do these changes do?

Perf gain: ~15% against main branch with Ray 8 cores.

import modin.pandas as pd
from modin.utils import execute
import numpy as np

from time import time

df1 = pd.DataFrame(np.random.randint(1_000_000, size=(10_000, 100)))
df2 = pd.DataFrame(np.random.randint(1_000_000, size=(1_000_000, 100)))

for _ in range(5):
    start = time()
    df2._query_compiler._modin_frame._deferred_index = True
    res = df1.merge(df2, on=3)
    execute(res)
    print(f"merge time: {time()-start}")
  • first commit message and PR title follow format outlined here

    NOTE: If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.

  • passes flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
  • passes black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
  • signed commit with git commit -s
  • Resolves Avoid using synchronize_labels for combine function #7299
  • tests added and passing
  • module layout described at docs/development/architecture.rst is up-to-date

…nchronize_labels' for 'combine' function

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
@anmyachev anmyachev changed the title PERF-#7299: Use lazy_metadata_decorator instead of synchronize_labels for combine function PERF-#7299: Avoid using synchronize_labels for combine function Jun 6, 2024
Comment on lines +2896 to +2899
if self._deferred_index:
new_index = self.index
if self._deferred_column:
new_columns = self.columns
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A further improvement could be to get rid of the materialization of indexes in the main process. However this also happens in _propagate_index_objs function now.

@anmyachev anmyachev marked this pull request as ready for review June 6, 2024 22:11
Copy link
Collaborator

@devin-petersohn devin-petersohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great @anmyachev!

I think a good medium term goal would be to have support for a fully lazy index object, adding it as a first class citizen to the query compiler (and adding index.py to modin/pandas.

LGTM

@anmyachev anmyachev merged commit af5ed06 into modin-project:main Jun 7, 2024
37 checks passed
@anmyachev anmyachev deleted the issue7299 branch June 7, 2024 21:31
@YarShev
Copy link
Collaborator

YarShev commented Jun 10, 2024

This is great @anmyachev!

I think a good medium term goal would be to have support for a fully lazy index object, adding it as a first class citizen to the query compiler (and adding index.py to modin/pandas.

LGTM

@dchigarev, @anmyachev, to what extent does our current ModinIndex perform this task?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid using synchronize_labels for combine function
3 participants