nick8325 / quickcheck

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

Functor ((:->) a) Poor Performance #277

Closed BebeSparkelSparkel closed 4 years ago

BebeSparkelSparkel commented 4 years ago

The following has very poor performance

fit "QuickCheck profile" $ property $
  \( applyFun -> g :: Int -> [[Int]]
   , applyFun -> h :: [[Int]] -> Int
   , x
   ) -> do
     h (g (x)) `shouldBe` (h . g $ x)\

parse-it-test.prof.txt

phadej commented 4 years ago

I wouldn't say it's fmap which slow, but that generated data simply quite big. My initial guess is that Fun [[Int]] Int is quite big structure, when applied to [[Int]] which is quadratic in size (~100 lists of ~100 element lists).

BebeSparkelSparkel commented 4 years ago

Would you consider 100^2 large?

BebeSparkelSparkel commented 4 years ago

Seems like 10,000 or even 100,000 should be a reasonable amount of data to test with.

phadej commented 4 years ago

well, 10000 elements * 100 tests (which I suspect is default) can make test run for a half a second, which isn't long time.

I suspect that doubling maxSize (from default 100 to 200) would make test run take roughly 4 times the time.

BebeSparkelSparkel commented 4 years ago

Ok, I'll cut down the test sizes except for pushes. Thanks