nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
713 stars 119 forks source link

Compatibility with new version of random #303

Closed lehins closed 4 years ago

lehins commented 4 years ago

This PR implements compatibility with random-1.2.0, which was finally released today

NorfairKing commented 4 years ago

This promises amazing performance gains. I'm looking forward to it!

phadej commented 4 years ago

@NorfairKing QuickCheck is already using splitmix and not using random for about anything, so I wouldn't expect much more speedups than what 2.14 already brought to the table. See also #299 (which I'd prefer this PR to based on).

Also I don't see anything truly breaking here, thus I'm not sure 2.15 bump is justified.

lehins commented 4 years ago

@phadej switched to 0.14.1

wouldn't expect much more speedups than what 2.14 already brought to the table

Looks like all you had to do was wait for the new version of random to be released, instead now there is NO_SPLITMIX all over the place.

Any reconciliation choose function will get faster ;)

phadej commented 4 years ago

NO_SPLITMIX is new NO_TF_RANDOM, which was introduced in 2014 ;) And I think the research behind tf-random was motivated by QuickCheck use case.

lehins commented 4 years ago

Yeah, I remember about tf-random, I am not sure what happened, but somehow it got stalled. Thank you for implementing the splitmix package, otherwise we'd still be stuck with outdated RNGs.

In any case, now that random-1.2 is out NO_SPLITMIX seems silly:

#ifdef NO_SPLITMIX
newtype QCGen = QCGen StdGen
#else
newtype QCGen = QCGen SMGen
#endif

Considering the new definition of StdGen:

newtype StdGen = StdGen { unStdGen :: SMGen }

It's up to you, of course, what you are going to do about it, if anything at all. Matters to me not.

phadej commented 4 years ago
#ifdef NO_SPLITMIX
newtype QCGen = QCGen StdGen
#else
newtype QCGen = QCGen SMGen
#endif

matters for GHCs older than 8.2. And because QuickCheck is testing library, I think it's justified to do a little of CPP to extend support window by a lot.

lehins commented 4 years ago

@phadej FYI, we extended support to ghc>=7.10 in random-1.2

phadej commented 4 years ago

@lehins good to know, thanks!