Dataframe BenchMEASURED IN ONE ENVIRONMENT

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

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

    Left join against a 1,000-row key table.

    Result

    Runpandas mergepolars joinRatio
    Run 131.112.7311.40×
    Run 238.453.4211.24×
    Run 330.992.8111.03×

    Spread over 3 runs: pandas merge CV 12.7% / polars join CV 12.7% / ratio CV 1.6%

    The two calls

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

    Conditions

    Both sides build the same hash table on an integer key.

    Where this number does not apply

    A join against a large table has different memory behaviour and is not covered by the small-join number.

    Reproduce

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