[FR] Setup and teardown that only runs once for a benchmark with the same parameters

Đang mở
#1,874 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
performance

Hướng nghiên cứu

Bắt đầu từ entry point RegisterBenchmark được mô tả trong issue và theo dõi cách các tham số benchmark, số lần lặp, setup và teardown được xử lý. Xác định SetupOnce và TeardownOnce nên hoạt động như thế nào đối với từng tập tham số, bao gồm cả ví dụ về định dạng tệp đã nêu; payload không chỉ rõ tệp hoặc test nào cần chạy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem? Please describe.
Setup and Teardown run for every repetition of the benchmark. As the runner gathers timings it keeps running setup and teardown unnecessarily.

Describe the solution you'd like
For a given benchmark with a specific set of parameters, there should be a way to specify a setup and teardown that runs exactly once.
e.g. RegisterBenchmark(name, func, params...)->SetupOnce(functor)->TeardownOnce(functor).

Describe alternatives you've considered
I haven't found an alternative other than allowing setup and teardown to run unnecessarily and consume resources.

Additional context
If I were trying to benchmark reading the same data from alternative file formats. I might make a general function that can be parameterized on the different formats. The setup would create the file, teardown would delete the file, and the benchmark would extract the data.

It's unnecessary for the setup and teardown to do that again and again for each repetition of the same benchmark with the same parameters. Especially if, say, you had to make the file very large to get accurate benchmark data.

Ngôn ngữ chính
C++
Star
10.5k
Fork
1.8k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/benchmark

Tất cả issue của google/benchmark

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.