[FR] Allow complexity to fit a constant offset

Đang mở
#2,391 1 bình luận 0 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
performance

Hướng nghiên cứu

Complexity fitters are implemented in src/complexity.cc (ComputeBigO) and exposed through the BigO enum in include/benchmark/benchmark.h; the BigO and RMS output columns are emitted by the reporters in src/reporter.cc and src/json_reporter.cc. Start by reading src/complexity.cc alongside test/complexity_test.cc to see how oN/oNLogN fits are computed and tested. Done means a new offset-aware fitter selectable from the benchmark registration, an extra output line for the constant term, and passing complexity tests.

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.
For some (cryptographic) algorithms that I'm benchmarking, the real complexity is something like O(a*N + C) where there is a fixed minimum running time that is non-trivial. Using the builtin oN complexity function always has a high RMS even though the actual times are quite linear (with an offset).

Describe the solution you'd like
Provide a different complexity fitter that will include a constant offset, with identical behavior to current complexity functions (no change to existing behaviors). When used with the new complexity function, a new Run output line would be included for the constant offset.

Describe alternatives you've considered
I can refactor all of my own functions to attempt to estimate the N=0 offset value.
But that will not be the same as a proper linear regression with offset, which has a closed form solution.

Additional context
An example of the output for one of the heavy-weight algorithms (ML-DSA-87) for varying plaintext sizes, which has a strong offset of ~700 us. Without fitting the offset, the RMS is very high.

BM_SigSign/MLDSA87/1024        709327 ns       654350 ns         4307
BM_SigSign/MLDSA87/4096        730189 ns       673641 ns         4299
BM_SigSign/MLDSA87/32768       800954 ns       738861 ns         3778
BM_SigSign/MLDSA87/262144     1197191 ns      1104392 ns         2440
BM_SigSign/MLDSA87/1048576    2587894 ns      2385932 ns         1185
BM_SigSign/MLDSA87_BigO          2.61 N          2.41 N    
BM_SigSign/MLDSA87_RMS             50 %            50 %    
Ngôn ngữ chính
C++
Star
10.5k
Fork
1.8k
Merge trung bình
2 ngày 1 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.