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

Fix benchmark build #196

Merged
merged 6 commits into from
May 6, 2020
Merged

Conversation

sjakobi
Copy link
Member

@sjakobi sjakobi commented Dec 20, 2019

Based on work by @hsyl20. (Thanks!)

Fixes #52.


TODO:

  • Fix deprecation warnings.

hsyl20 and others added 3 commits December 20, 2019 07:22
… which currently fails with
    BenchAll.hs:173:55:
        No instance for (Random Word8)
          arising from a use of `random'
        Possible fix: add an instance declaration for (Random Word8)
        In the second argument of `(.)', namely `random'
        In the second argument of `S.unfoldrN', namely `(Just . random)'
        In the second argument of `(.)', namely
          `S.unfoldrN 10000 (Just . random)'
blaze-builder-0.3.* is incompatible with GHC >= 8.4

With --allow-newer it fails to build with:

    /tmp/stack26342/blaze-builder-0.3.3.4/Blaze/ByteString/Builder/Internal/Types.hs:71:10: error:
        • No instance for (Semigroup Builder)
           arising from the superclasses of an instance declaration
        • In the instance declaration for ‘Monoid Builder’
       |
    71 | instance Monoid Builder where
       |          ^^^^^^^^^^^^^^
@sjakobi
Copy link
Member Author

sjakobi commented Dec 20, 2019

At this point benchmarks build with GHC 7.2 up and including to 8.2.

For GHC >= 8.4 there is no build plan due to incompatibility with blaze-builder-0.3.*.

-- There is no point using blaze-builder-0.4+ as that
-- version is just a wrapper around bytestring itself,
-- abd so a comparison benchmark would have no purpose.
, blaze-builder == 0.3.*

I'm not yet sure how to best resolve that.

bench/bench-bytestring.cabal Outdated Show resolved Hide resolved
@sjakobi
Copy link
Member Author

sjakobi commented Dec 20, 2019

bench-bytestring-builder produces a bunch of deprecation warnings for Data.ByteString.findSubstrings:

, bgroup "substrings"
[ bgroup "easy"
[ bench "easy1" . nf (uncurry S.findSubstrings)
$ easySubstrings 1 1000000
, bench "easy4" . nf (uncurry S.findSubstrings)
$ easySubstrings 4 1000000
, bench "easy16" . nf (uncurry S.findSubstrings)
$ easySubstrings 16 1000000
, bench "easy64" . nf (uncurry S.findSubstrings)
$ easySubstrings 64 1000000
, bench "easy128" . nf (uncurry S.findSubstrings)
$ easySubstrings 128 1000000
, bench "easy1024" . nf (uncurry S.findSubstrings)
$ easySubstrings 1024 1000000
]
, bgroup "random"
[ bench "random1" . nf (uncurry S.findSubstrings)
$ randomSubstrings 1 1000000
, bench "random4" . nf (uncurry S.findSubstrings)
$ randomSubstrings 4 1000000
, bench "random16" . nf (uncurry S.findSubstrings)
$ randomSubstrings 16 1000000
, bench "random64" . nf (uncurry S.findSubstrings)
$ randomSubstrings 64 1000000
, bench "random128" . nf (uncurry S.findSubstrings)
$ randomSubstrings 128 1000000
, bench "random1024" . nf (uncurry S.findSubstrings)
$ randomSubstrings 1024 1000000
]
, bgroup "hard"
[ bench "hard1" . nf (uncurry S.findSubstrings)
$ hardSubstrings 1 1000000
, bench "hard4" . nf (uncurry S.findSubstrings)
$ hardSubstrings 4 1000000
, bench "hard16" . nf (uncurry S.findSubstrings)
$ hardSubstrings 16 1000000
, bench "hard64" . nf (uncurry S.findSubstrings)
$ hardSubstrings 64 1000000
, bench "hard128" . nf (uncurry S.findSubstrings)
$ hardSubstrings 128 1000000
, bench "hard1024" . nf (uncurry S.findSubstrings)
$ hardSubstrings 1024 1000000
]
, bgroup "pathological"
[ bench "pathological1" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 1 1000000
, bench "pathological4" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 4 1000000
, bench "pathological16" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 16 1000000
, bench "pathological64" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 64 1000000
, bench "pathological128" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 128 1000000
, bench "pathological1024" . nf (uncurry S.findSubstrings)
$ pathologicalSubstrings 1024 1000000
]
, bgroup "html"
[ bench "html1" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 1 1000000
, bench "html4" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 4 1000000
, bench "html16" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 16 1000000
, bench "html64" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 64 1000000
, bench "html128" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 128 1000000
, bench "html1024" . nfIO . fmap (uncurry S.findSubstrings)
$ htmlSubstrings wikiPage 1024 1000000
]
]

#181 removes findSubstrings and these benchmarks, so I'd suggest not fixing the warnings for now.

@sjakobi
Copy link
Member Author

sjakobi commented Dec 20, 2019

bench-bytestring builds and runs with GHC 7.2 up to and including 8.8 now – please review! :)

@sjakobi sjakobi changed the title WIP: Fix benchmark build Fix benchmark build Dec 20, 2019
@hsyl20
Copy link
Contributor

hsyl20 commented Dec 20, 2019

LGTM. Thanks!

if impl(ghc >= 8.4)
build-depends: blaze-builder >= 0.3 && < 0.5
else
build-depends: blaze-builder == 0.3.*
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, it seemed suboptimal to disable so many benchmarks when building with GHC-8.4+. Instead, I have relaxed the version constraint on blaze-builder when building with those GHC versions.

The comparison with blaze-builder isn't going to be very useful when using GHC-8.4+, but it shouldn't hurt either.

@cartazio
Copy link

cartazio commented May 6, 2020

@sjakobi whats needed to make this good to merge? lets catsup on the deb :)

@cartazio
Copy link

cartazio commented May 6, 2020

*debt

@sjakobi
Copy link
Member Author

sjakobi commented May 6, 2020

@cartazio I believe this PR is ready to merge.

@cartazio
Copy link

cartazio commented May 6, 2020

Cool.

@cartazio cartazio merged commit 38ad056 into haskell:master May 6, 2020
@sjakobi sjakobi deleted the hsyl20-fix-benchmarks branch May 6, 2020 19:41
@sjakobi
Copy link
Member Author

sjakobi commented May 6, 2020

Many thanks, @cartazio! :)

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.

Cannot benchmark
3 participants