Pyベンチ実測MEASURED, NOT RECALLED

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

    dict.fromkeys is ~1.49× slower than set() で重複除去

    `dict.fromkeys` dedupes ~1.5× faster than `set()` — and keeps insertion order.

    Result

    Runset() で重複除去dict.fromkeysRatio
    Run 15.3268.0030.67×
    Run 25.4408.2070.66×
    Run 35.7578.0860.71×

    Spread over 3 runs: set() で重複除去 CV 3.3% / dict.fromkeys CV 1.0% / Ratio CV 3.4%

    5.33 ms8.00 msRun15.44 ms8.21 msRun25.76 ms8.09 msRun3set() で重複除去 (#b9c6d2) / dict.fromkeys (#2f6f4f)

    Conditions

    Deduping 300,000 items with 5,000 distinct values.

    Where this number does not apply

    If order does not matter the gap matters less; both require hashable items.

    Reproduce

    cd bench && python micro_py.py --out ../data/run.json --samples 21