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

Replace BigInt with a native type #371

Open
ghost opened this issue Sep 22, 2021 · 4 comments
Open

Replace BigInt with a native type #371

ghost opened this issue Sep 22, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 22, 2021

Our use of BigInt internally is the cause of some slowness, and I've shown in #135 (comment) that by replacing it we can get immediate efficiency improvements. This however can't be done naively, so we'll need to consider how we support generation of uint64, int64, double, and bigint with a different internal type.

Something we may want to consider is grouping numeric types into a few categories:

  • Signed integers (int8, int16, int32, int64)
  • Unsigned integers (uint8, uint16, uint32, uint64)
  • Floating point numbers (single, double)

Then we can have one integral function for each category that uses the largest number in its category to generate from. This would help us avoid weird conversion issues and allow us to drop BigInt internally.

I do, however, think we should add a Gen.bigint function. But that is outside the scope of this issue, and should be considered on its own merit.

Thoughts?

/cc @TysonMN @dharmaturtle @moodmosaic

@TysonMN
Copy link
Member

TysonMN commented Sep 23, 2021

Can you first create benchmarks in the benchmark project using BenchmarkDotNet?

@cmeeren
Copy link
Contributor

cmeeren commented Nov 5, 2022

Would love for Hedgehog to be faster. While I will continue using Hedgehog over FsCheck due to integrated shrinking, the significantly slower performance is a notable drawback in several of my test suites.

Alternatively, better performance could allow using a higher test count with no loss of test suite runtime.

@TysonMN
Copy link
Member

TysonMN commented Jul 22, 2023

@cmeeren, for any pair of BenchmarkDotNet tests you create comparing Hedgehog and FsCheck, I will do my best to optimize Hedgehog to be competitive in that comparison.

This is helpful for me for two reasons. First, between this issue and the linked one from the OP, you seem to know of many places in Hedgehog that are slow. Second, you know how to use FsCheck and what the equivalent would be.

Want to take me up on this offer?

@cmeeren
Copy link
Contributor

cmeeren commented Jul 22, 2023

Thanks for the challenge, @TysonMN!

"Unfortunately", all those years back when I posted the linked issue, I ended up using Hedgehog after all (integrated shrinking was the tipping factor). I never used FsCheck much, and it's been so long that I've forgotten everything about it. (I can't even remember if I ever used it seriously or just experimented with it; my guess is the latter.) I certainly have no FsCheck code left anywhere; I think even the codebases where I used it for testing now no longer exist at all.

Also, for now, my "OSS quota" will be filled working on Faqt (also a testing-related library, as it happens).

So unfortunately I'm going to have to decline the request.

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

No branches or pull requests

2 participants