fury icon indicating copy to clipboard operation
fury copied to clipboard

[Python] pyfury, loky, pickle performance

Open jacktang opened this issue 2 years ago • 6 comments

Hello there,

Did you have some benchmarks on pyfury, loky and pickle? Thanks!

jacktang avatar Aug 09 '23 05:08 jacktang

We did some simple benchmarks with pickle before, loky is not benchmarked.

There are still many space for performance optimization in python serialization, we haven't do the benchmark thoroughly.

chaokunyang avatar Aug 09 '23 06:08 chaokunyang

@chaokunyang Thanks for the quick reply. I read the python code quickly, and does pyfury supports python function serialization now?

jacktang avatar Aug 09 '23 07:08 jacktang

It doesn't support, you can pass a callback to let cloudpickle handle it

chaokunyang avatar Aug 09 '23 07:08 chaokunyang

from dataclasses import dataclass
from typing import List

@dataclass
class Foo:
    f1: int
    f2: int
    f3: float
    f4: int
    f5: int
    f6: List[int]

foos = [Foo(f1=1000, f2=2**30, f3=1/3, f4=100, f5=200, f6=[11, 1234]) for i in range(1000)]

fury = pyfury.Fury(language=pyfury.Language.PYTHON)
fury.register_class(Foo)

FYI, for above cases, fury is 1.35x faster than pickle. image

There are still many virtual method calls in fury python, which we don't optimize still .

chaokunyang avatar Aug 09 '23 07:08 chaokunyang

@jacktang Is your question answered?

esafak avatar Jul 06 '25 21:07 esafak

@chaokunyang Thanks for the quick reply. I read the python code quickly, and does pyfury supports python function serialization now?

@jacktang It supports now. You can use pyfory as a drop-in replacement for pickle/cloudpickle. And fory has 3x higher compression ratio.

See document in https://fory.apache.org/docs/docs/guide/python_serialization#drop-in-replacement-for-picklecloudpickle

chaokunyang avatar Nov 05 '25 05:11 chaokunyang