Skip to content

Larger keys for intmap and intset #790

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

Closed
wants to merge 11 commits into from

Conversation

jwaldmann
Copy link
Contributor

@jwaldmann jwaldmann commented Jul 22, 2021

as discussed in #788 .

I have no idea on how to best pass the "-a N" option for testing. Does it go in haskell-ci.yml, or in cabal.haskell-ci? or in containers.cabal?

or in the source? That seems easiest to do, and most stable (independent from build/CI tooling) but it would ignore command-line options, which is bad? https://hackage.haskell.org/package/test-framework-0.8.2.0/docs/Test-Framework-Runners-Console.html#v:defaultMainWithArgs

Adding --test-option="-a 10000" does seem to increase CI build times - quite drastically. Or, they weren't very stable to begin with.

@sjakobi
Copy link
Member

sjakobi commented Jul 30, 2021

I have no idea on how to best pass the "-a N" option for testing. Does it go in haskell-ci.yml, or in cabal.haskell-ci? or in containers.cabal?

or in the source? That seems easiest to do, and most stable (independent from build/CI tooling) but it would ignore command-line options, which is bad? https://hackage.haskell.org/package/test-framework-0.8.2.0/docs/Test-Framework-Runners-Console.html#v:defaultMainWithArgs

So in dhall's testsuite we have a little helper that we use to specify the number of QuickCheck tests in the code, but that can still be overriden on the CLI with a higher number of tests:

https://github.com/dhall-lang/dhall-haskell/blob/8aed63714def462056847f685f5871d74c12b6cf/dhall/tests/Dhall/Test/QuickCheck.hs#L787-L791

We're using tasty though – I don't know whether something similar can be achieved with test-framework.

Since test-framework is basically unmaintained, and since tasty's API has a large overlap with test-framework, maybe we should migrate to tasty anyway?

@Bodigrim
Copy link
Contributor

Migration to tasty usually boils down to renaming imports and wrapping top-level tests in testGroup “All”. The sooner we leave test-framework in the past, the better.

@sjakobi
Copy link
Member

sjakobi commented Aug 5, 2021

@treeowl How do you feel about migrating to tasty?

@treeowl
Copy link
Contributor

treeowl commented Aug 5, 2021 via email

@treeowl
Copy link
Contributor

treeowl commented Aug 17, 2021

Oh yeah, this discussion. Someone came up with something pretty decent (I think) for my little toy compact-sequences package. Does that look like something we could reasonably copy, or is it not up to the challenge of a big test suite?

@treeowl
Copy link
Contributor

treeowl commented Aug 17, 2021

Now that I've merged #796, can you do what you want with test case sizes here? Ideally, I like to run tests three ways:

  1. Many small cases.
  2. A moderate number of moderately sized cases.
  3. A small number of large cases.

The three ways should be tweaked to run in the same amount of time (give or take an order of magnitude or so). This should be almost as good as SmallCheck for the small cases, but also be likely to catch glaring mistakes in large ones.

@treeowl
Copy link
Contributor

treeowl commented Mar 11, 2022

I'd feel more comfortable about this if we tested with multiple sizes. See treeowl/compact-sequences@585bfac for a commit doing so elsewhere.

@jwaldmann
Copy link
Contributor Author

jwaldmann commented Mar 11, 2022

tested with multiple sizes

OK, I'll look into this.

Just for calibration, this (on my local machine)

time cabal test all --test-show-details=direct --test-options="--quickcheck-tests 1000 --quickcheck-max-size 100"

real    0m20.246s
user    1m18.343s
sys     0m4.309s

is about 3 min on CI.

Runtime does increase strongly with max-size.

@jwaldmann
Copy link
Contributor Author

now the test run takes 25 min in CI (for each ghc version). that's too much?

@treeowl
Copy link
Contributor

treeowl commented Mar 11, 2022

Ouch. Yeah, that seems excessive. Did you limit that to just IntMap and IntSet?

@jwaldmann
Copy link
Contributor Author

jwaldmann commented Mar 11, 2022

no, I applied globally. jwaldmann@3a3929d

In theory, your method (lots of small, some large, etc.) should be fine for all tests?

@treeowl
Copy link
Contributor

treeowl commented Mar 11, 2022

Yeah, it should work, but it's pricy. IntMap and IntSet seem much more likely than the other structures to exhibit special behavior around size extremes.

@jwaldmann
Copy link
Contributor Author

I did restrict the test sets that get larger parameters. It's still expensive, and the programming gets ugly. I am not an expert at tasty's not-quite-regexps, and CI's not-quite-bash.

OTOH, perhaps 20 min (per GHC version) isn't too bad. If it catches bugs? The contributor can run faster tests locally. The maintainer needs days to accept the PR, anyway. Which is fine. (Though, a more clever CI would use that waiting time to run extra tests ... or even write some...)

@treeowl
Copy link
Contributor

treeowl commented Jan 21, 2023

Looking over the conversation, it's not clear whether everything is resolved. Could you possibly update?

@jwaldmann jwaldmann force-pushed the larger-keys-for-intmapset branch from 9991a87 to b74aea4 Compare January 21, 2023 19:15
@jwaldmann
Copy link
Contributor Author

jwaldmann commented Jan 21, 2023

I'm on it (just did a rebase).

I wanted to take up #787 again. I was benchmarking NFA-DFA conversion with several Map IntSet foo implementations (hint: HashMap wins, Data.Map seems close, but only with the non-allocation Ord instance. I think.)

[EDIT] see https://gitlab.imn.htwk-leipzig.de/waldmann/fdaln/-/blob/master/DFA.hs

@meooow25
Copy link
Contributor

The large keys part of this is obsolete (#788 (comment)), but this PR also bumps the quickcheck args. Not sure if we still want to do that?

@meooow25
Copy link
Contributor

meooow25 commented Aug 2, 2024

Closing for now. Bumping the number of quickcheck tests seems like a good idea, so we can still do that. It will probably need to be configured via the cabal.haskell-ci file.

@meooow25 meooow25 closed this Aug 2, 2024
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.

5 participants