summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarson Ip <carsonip715@gmail.com>2020-01-17 12:41:42 +0800
committerJeff Widman <jeff@jeffwidman.com>2020-02-05 15:23:57 -0800
commit385f60316eef4f16922c56a4b0f1a0e0891530d2 (patch)
tree13f0602743237ea9f9a1667825718c00d245d6cb
parentd54aaf6a46dbd981a0bb08570d94b4d8c4c59aef (diff)
downloadkafka-python-385f60316eef4f16922c56a4b0f1a0e0891530d2.tar.gz
Fix benchmarks to use pyperf
-rw-r--r--benchmarks/README6
-rw-r--r--benchmarks/record_batch_compose.py8
-rw-r--r--benchmarks/record_batch_read.py8
-rw-r--r--benchmarks/varint_speed.py4
4 files changed, 13 insertions, 13 deletions
diff --git a/benchmarks/README b/benchmarks/README
index 531b789..1c12035 100644
--- a/benchmarks/README
+++ b/benchmarks/README
@@ -1,4 +1,4 @@
The `record_batch_*` benchmarks in this section are written using
-``perf`` library, created by Viktor Stinner. For more information on how to get
-reliable results of test runs please consult
-https://perf.readthedocs.io/en/latest/run_benchmark.html.
+``pyperf`` library, created by Victor Stinner. For more information on
+how to get reliable results of test runs please consult
+https://pyperf.readthedocs.io/en/latest/run_benchmark.html.
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)
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)
diff --git a/benchmarks/varint_speed.py b/benchmarks/varint_speed.py
index 624a12a..fd63d0a 100644
--- a/benchmarks/varint_speed.py
+++ b/benchmarks/varint_speed.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
-import perf
+import pyperf
from kafka.vendor import six
@@ -398,7 +398,7 @@ _assert_valid_dec(decode_varint_3)
# import dis
# dis.dis(decode_varint_3)
-runner = perf.Runner()
+runner = pyperf.Runner()
# Encode algorithms returning a bytes result
for bench_func in [
encode_varint_1,