stdlib-js / stdlib-js/stdlib

[RFC]: Improve sorted arrays generation in C benchmarks for sorted-input packages

Đang mở
#10,415 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
6k
Fork
1.3k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
611

Mô tả

### Description

This RFC proposes to generalize the generation of random arrays in C benchmarks for sorted-input packages. It mainly tries to add a random factor for the generated values and make use of the already existing `rand_double()` function and `time.h` header for consistency between packages.

For example, for double precision packages, to be changed from: (e.g., from `stats/base/strided/dminsorted`)
```C
x = (double *) malloc( len * sizeof( double ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = i;
}
```
To:
```C
x = (double *) malloc( len * sizeof( double ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = (double)i + rand_double();
}
```
Packages that are directly affected by this (add more if found):

- [ ] `stats/strided/dmediansorted`
- [ ] `stats/strided/dmaxsorted`
- [ ] `stats/strided/dminsorted`
- [ ] `stats/strided/smediansorted`
- [ ] `stats/strided/smaxsorted`
- [ ] `stats/strided/sminsorted`

### Related Issues

None.

### Questions

#### Question 1
I suggest that we either enforce this or refactor the already existing packages that don't use any randomness by removing the `time.h` header and `rand_double()` function since they're not used anywhere in the benchmark.

#### Question 2
What about the absolute sorted-input packages? Current approach is: (from `stats/base/strided/dmaxabssorted`)
```C
x = (double *) malloc( len * sizeof( double ) );
for ( i = 0; i < len; i++ ) {
x[ i ] = i - (len/2);
}
```

### Other

No.

### Checklist

- [x] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.
- [x] The issue name begins with `RFC:`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reviewing the listed stats/strided/*sorted benchmark packages, especially dmediansorted, dmaxsorted, dminsorted, smediansorted, smaxsorted, and sminsorted, along with their existing rand_double() and time.h usage. Resolve whether absolute sorted-input packages are included; done means the agreed generation approach is applied consistently or unused randomness support is removed across the affected benchmarks.

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

Đánh giá

Công nghệ
c
Lĩnh vực
performance
Loại issue
Tái cấu trúc
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.