MCPcopy Create free account
hub / github.com/apache/fory / test_encode

Function test_encode

python/pyfory/tests/benchmark.py:28–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27@pytest.mark.skip(reason="take too long")
28def test_encode():
29 # print("schema", foo_schema())
30 encoder = fory.create_row_encoder(foo_schema())
31 foo = create_foo()
32 row = encoder.to_row(foo)
33 assert foo == encoder.from_row(row)
34
35 t1 = timeit.timeit(lambda: encoder.to_row(foo), number=iter_nums)
36 print("encoder take {0} for {1} times, avg: {2}".format(t1, iter_nums, t1 / iter_nums))
37 t2 = timeit.timeit(lambda: pickle.dumps(foo), number=iter_nums)
38 print("pickle take {0} for {1} times, avg: {2}".format(t2, iter_nums, t2 / iter_nums))
39
40
41@pytest.mark.skip(reason="take too long")

Callers 1

benchmark.pyFile · 0.70

Calls 6

foo_schemaFunction · 0.90
create_fooFunction · 0.90
from_rowMethod · 0.80
to_rowMethod · 0.45
formatMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected