Skip to content

⚡️ Faster generate for constant and constantFrom #1945

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

Merged
merged 1 commit into from
Jun 2, 2021

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Jun 2, 2021

Improve performance of the generate method on constants arbitraries. The custom get value of NextValue constructor was adding an extra cost to the generate cost.

From my measurements, improvements are significants:

Property(fc.constant('a')) on fast-check@2.14.0 x 6,653 ops/sec ±0.60% (91 runs sampled)
Property(fc.constant('a')) on fast-check@2.15.0 x 2,290 ops/sec ±3.02% (80 runs sampled)
Property(fc.constant('a')) on fast-check@99.99.99 x 3,374 ops/sec ±3.76% (82 runs sampled)

99.99.99 is master + the change

Category:

  • ✨ Introduce new features
  • 📝 Add or update documentation
  • ✅ Add or update tests
  • 🐛 Fix a bug
  • 🏷️ Add or update types
  • Other(s): Performances

Potential impacts:

  • Generated values
  • Shrink values
  • Performance
  • Typings
  • Other(s): ...

Sorry, something went wrong.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 2, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d4d9a02:

Sandbox Source
Vanilla Configuration
fast-check-examples Configuration

@codecov
Copy link

codecov bot commented Jun 2, 2021

Codecov Report

Merging #1945 (d4d9a02) into main (dbe625b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1945   +/-   ##
=======================================
  Coverage   97.49%   97.49%           
=======================================
  Files         166      166           
  Lines        4117     4118    +1     
  Branches      799      800    +1     
=======================================
+ Hits         4014     4015    +1     
  Misses         99       99           
  Partials        4        4           
Flag Coverage Δ
unit-tests 97.49% <100.00%> (+<0.01%) ⬆️
unit-tests-10.x-Linux 97.49% <100.00%> (+<0.01%) ⬆️
unit-tests-12.x-Linux 97.49% <100.00%> (+<0.01%) ⬆️
unit-tests-14.x-Linux 97.49% <100.00%> (+<0.01%) ⬆️
unit-tests-16.x-Linux 97.49% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/arbitrary/_internals/ConstantArbitrary.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbe625b...d4d9a02. Read the comment docs.

@dubzzz dubzzz merged commit cc512e9 into main Jun 2, 2021
@dubzzz dubzzz deleted the faster-gen-constant branch June 2, 2021 18:26
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.

None yet

1 participant