mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-21 00:24:37 +03:00
afae2ad5fe
* make recurse_jsonify() work directly on types, circumventing the dataclasses.asdict() step. This enables simpler integration of non dataclasses into the Streamable and JSON protocols * add benchmark for Streamable.to_json_dict()
24 lines
478 B
Python
24 lines
478 B
Python
import random
|
|
from time import perf_counter
|
|
|
|
from tests.util.test_full_block_utils import get_full_blocks
|
|
|
|
random.seed(123456789)
|
|
|
|
|
|
def main() -> None:
|
|
total_time = 0.0
|
|
counter = 0
|
|
for block in get_full_blocks():
|
|
start = perf_counter()
|
|
block.to_json_dict()
|
|
end = perf_counter()
|
|
total_time += end - start
|
|
counter += 1
|
|
|
|
print(f"total time: {total_time:0.2f}s ({counter} iterations)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|