Serialization¶
Serialization function.
- mpacklog.serialize.serialize(obj)¶
Serialize an object for message packing.
- Parameters:
obj – Object to serialize.
- Returns:
Serialized object.
Note
Calling the numpy conversion is much faster than the default list constructor:
In [1]: x = random.random(6) In [2]: %timeit list(x) 789 ns ± 5.79 ns per loop (mean ± std. dev. of 7 runs, 1e6 loops each) In [3]: %timeit x.tolist() 117 ns ± 0.865 ns per loop (mean ± std. dev. of 7 runs, 1e7 loops each)