Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[byteorder] Optimize tests; large impact on Miri #350

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Sep 7, 2023

While they take a trivial amount of time running natively, the test_native_endian and test_non_native_endian unit tests previously took a long time to execute on Miri, slowing down local development and CI. As of the writing of this commit message, I was experiencing execution times for each test of ~60s.

This commit optimizes those tests in two ways:

  • Use a faster RNG
  • When running under Miri (detected using cfg!(miri)), perform a single loop iteration rather than 1024

Using time cargo miri test -- --skip ui, I have benchmarked the execution time before this commit at ~2m36s and the time after this commit at ~8s.

While they take a trivial amount of time running natively, the
`test_native_endian` and `test_non_native_endian` unit tests previously
took a long time to execute on Miri, slowing down local development and
CI. As of the writing of this commit message, I was experiencing
execution times for each test of ~60s.

This commit optimizes those tests in two ways:
- Use a faster RNG
- When running under Miri (detected using `cfg!(miri)`), perform a
  single loop iteration rather than 1024

Using `time cargo miri test -- --skip ui`, I have benchmarked the
execution time before this commit at ~2m36s and the time after this
commit at ~8s.
@joshlf joshlf force-pushed the faster-byteorder-miri-test branch from 7453530 to 044bfba Compare September 7, 2023 23:09
@joshlf joshlf merged commit a494e2b into main Sep 7, 2023
@joshlf joshlf deleted the faster-byteorder-miri-test branch September 7, 2023 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant