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_read.py | |
parent | d54aaf6a46dbd981a0bb08570d94b4d8c4c59aef (diff) | |
download | kafka-python-385f60316eef4f16922c56a4b0f1a0e0891530d2.tar.gz |
Fix benchmarks to use pyperf
Diffstat (limited to 'benchmarks/record_batch_read.py')
-rw-r--r-- | benchmarks/record_batch_read.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/benchmarks/record_batch_read.py b/benchmarks/record_batch_read.py index fc01e42..aa5e9c1 100644 --- a/benchmarks/record_batch_read.py +++ b/benchmarks/record_batch_read.py @@ -5,7 +5,7 @@ import itertools import os import random -import perf +import pyperf from kafka.record.memory_records import MemoryRecords, MemoryRecordsBuilder @@ -61,7 +61,7 @@ def func(loops, magic): # Main benchmark code. batch_data = next(precomputed_samples) - t0 = perf.perf_counter() + t0 = pyperf.perf_counter() for _ in range(loops): records = MemoryRecords(batch_data) while records.has_next(): @@ -70,13 +70,13 @@ def func(loops, magic): for record in batch: results.append(record.value) - 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_read_v0', func, 0) runner.bench_time_func('batch_read_v1', func, 1) runner.bench_time_func('batch_read_v2', func, 2) |