Dataframe BenchMEASURED IN ONE ENVIRONMENT

    ↑↓ to select, Enter to open, Esc to close

    pandas merge is ~11.93× slower than polars join for joining a 10,000-row lookup

    Same shape as the small join, with a ten times larger right side.

    Result

    Runpandas mergepolars joinRatio
    Run 132.792.7511.93×
    Run 235.192.7912.61×
    Run 335.423.4110.39×

    Spread over 3 runs: pandas merge CV 4.2% / polars join CV 12.4% / ratio CV 9.7%

    The two calls

    df.merge(lookup, on='g', how='left')
    df.join(lookup, on='g', how='left')

    Conditions

    10,000 distinct keys on the right, 400,000 rows on the left.

    Where this number does not apply

    Duplicated keys on the right would multiply rows and change the cost profile.

    Reproduce

    cd bench && python run.py --run 1 --out ../data/run1.json