diff options
author | Carson Ip <carsonip715@gmail.com> | 2020-01-17 12:41:42 +0800 |
---|---|---|
committer | Jeff Widman <jeff@jeffwidman.com> | 2020-02-05 15:23:57 -0800 |
commit | 385f60316eef4f16922c56a4b0f1a0e0891530d2 (patch) | |
tree | 13f0602743237ea9f9a1667825718c00d245d6cb /benchmarks/record_batch_compose.py | |
parent | d54aaf6a46dbd981a0bb08570d94b4d8c4c59aef (diff) | |
download | kafka-python-385f60316eef4f16922c56a4b0f1a0e0891530d2.tar.gz |
Fix benchmarks to use pyperf
Diffstat (limited to 'benchmarks/record_batch_compose.py')
-rw-r--r-- | benchmarks/record_batch_compose.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/benchmarks/record_batch_compose.py b/benchmarks/record_batch_compose.py index aca669d..5bdefa7 100644 --- a/benchmarks/record_batch_compose.py +++ b/benchmarks/record_batch_compose.py @@ -5,7 +5,7 @@ import itertools import os import random -import perf +import pyperf from kafka.record.memory_records import MemoryRecordsBuilder @@ -52,7 +52,7 @@ def func(loops, magic): results = [] # Main benchmark code. - t0 = perf.perf_counter() + t0 = pyperf.perf_counter() for _ in range(loops): batch = MemoryRecordsBuilder( magic, batch_size=DEFAULT_BATCH_SIZE, compression_type=0) @@ -64,14 +64,14 @@ def func(loops, magic): batch.close() results.append(batch.buffer()) - res = perf.perf_counter() - t0 + res = pyperf.perf_counter() - t0 finalize(results) return res -runner = perf.Runner() +runner = pyperf.Runner() runner.bench_time_func('batch_append_v0', func, 0) runner.bench_time_func('batch_append_v1', func, 1) runner.bench_time_func('batch_append_v2', func, 2) |