Skip to content

Commit

Permalink
test: Benchmark for record schema validation (#2053)
Browse files Browse the repository at this point in the history
* added benchmark for record validation with schema

* updated comments

* refactored to use itertools.repeat

* set number of runs to 1000

---------

Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
  • Loading branch information
BuzzCutNorman and edgarrmondragon authored Nov 22, 2023
1 parent 839fe6e commit 38d2ec2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/core/sinks/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,16 @@ def run_validate_and_parse():
_ = sink._validate_and_parse(record.copy())

benchmark(run_validate_and_parse)


def test_bench_validate_record_with_schema(benchmark, bench_sink, bench_record):
"""Run benchmark for Sink._validator method validate."""
number_of_runs = 1000

sink: BatchSinkMock = bench_sink

def run_validate_record_with_schema():
for record in itertools.repeat(bench_record, number_of_runs):
sink._validator.validate(record)

benchmark(run_validate_record_with_schema)

0 comments on commit 38d2ec2

Please sign in to comment.