Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Assert in slice16 hot loop to avoid bounds checks. #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

khrs
Copy link
Contributor

@khrs khrs commented Feb 22, 2023

Little help for compiler to eliminate bounds checks in hot loop. Biggest gain are in crc32/crc64/crc128

crc8/slice16            time:   [4.1465 µs 4.1499 µs 4.1542 µs]
                        thrpt:  [3.6731 GiB/s 3.6769 GiB/s 3.6799 GiB/s]
                 change:
                        time:   [-1.3003% -1.0348% -0.8107%] (p = 0.00 < 0.05)
                        thrpt:  [+0.8174% +1.0457% +1.3174%]
                        Change within noise threshold.
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) high mild
  2 (2.00%) high severe

crc16/slice16           time:   [4.1916 µs 4.1950 µs 4.1989 µs]
                        thrpt:  [3.6340 GiB/s 3.6374 GiB/s 3.6404 GiB/s]
                 change:
                        time:   [-6.0076% -5.1733% -4.3995%] (p = 0.00 < 0.05)
                        thrpt:  [+4.6020% +5.4555% +6.3915%]
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  4 (4.00%) high mild
  4 (4.00%) high severe

crc32/slice16           time:   [4.6525 µs 4.6926 µs 4.7364 µs]
                        thrpt:  [3.2216 GiB/s 3.2516 GiB/s 3.2797 GiB/s]
                 change:
                        time:   [-5.9927% -5.6196% -5.2235%] (p = 0.00 < 0.05)
                        thrpt:  [+5.5114% +5.9542% +6.3747%]
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  2 (2.00%) high mild
  9 (9.00%) high severe

crc64/slice16           time:   [5.3718 µs 5.3793 µs 5.3888 µs]
                        thrpt:  [2.8316 GiB/s 2.8366 GiB/s 2.8405 GiB/s]
                 change:
                        time:   [-13.005% -12.813% -12.565%] (p = 0.00 < 0.05)
                        thrpt:  [+14.371% +14.696% +14.950%]
                        Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
  4 (4.00%) low severe
  4 (4.00%) high mild
  12 (12.00%) high severe

crc82/slice16           time:   [15.866 µs 15.886 µs 15.911 µs]
                        thrpt:  [982.02 MiB/s 983.56 MiB/s 984.80 MiB/s]
                 change:
                        time:   [-9.7310% -9.2953% -8.9176%] (p = 0.00 < 0.05)
                        thrpt:  [+9.7907% +10.248% +10.780%]
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  1 (1.00%) high mild
  11 (11.00%) high severe

@akhilles
Copy link
Collaborator

This bumps MSRV, which I'm still considering (mainly for const generics). Maybe split the asserts into a separate PR so that the other changes can be merged?

@khrs khrs force-pushed the assert-to-avoid-bounds-checks branch from 76a053b to 007687a Compare February 23, 2023 20:26
@khrs
Copy link
Contributor Author

khrs commented Feb 23, 2023

Move "off-by-one" fix to #97

@akhilles
Copy link
Collaborator

See #96.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants