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

Rel8able records make app slow to start up #300

Open
seanhess opened this issue Dec 5, 2023 · 1 comment
Open

Rel8able records make app slow to start up #300

seanhess opened this issue Dec 5, 2023 · 1 comment

Comments

@seanhess
Copy link

seanhess commented Dec 5, 2023

I am experiencing extremely slow startup times in my application. I'm working on a web interface and I need tight reload times to see design changes as I make them. I stripped down my app and narrowed the issue down to Rel8. If my app has a record that derives Rel8able it takes a long time to start, and it gets worse in proportion to the number of fields. In my app I'm experiencing 2-3 second delays.

I'm using ghc 9.4.7, Ventura 13.4.1, cabal 3.10.2.0.

Minimal example. Run in cabal repl. Notice the ~1s delay between when you hit enter to run main and when the output appears. You can see it happen over and over if you reload with :r and run main again.

module Main where

import GHC.Generics
import Rel8
import Prelude


main :: IO ()
main = do
  putStrLn "Hello World!"


data Dataset' f = Dataset
  { test1 :: Column f String
  , test2 :: Column f String
  , test3 :: Column f String
  , test4 :: Column f String
  , test5 :: Column f String
  , test6 :: Column f String
  , test7 :: Column f String
  , test8 :: Column f String
  , test9 :: Column f String
  , test0 :: Column f String
  , atest1 :: Column f String
  , atest2 :: Column f String
  , atest3 :: Column f String
  , atest4 :: Column f String
  , atest5 :: Column f String
  , atest6 :: Column f String
  , atest7 :: Column f String
  , atest8 :: Column f String
  , atest9 :: Column f String
  , atest0 :: Column f String
  , btest1 :: Column f String
  , btest2 :: Column f String
  , btest3 :: Column f String
  , btest4 :: Column f String
  , btest5 :: Column f String
  , btest6 :: Column f String
  , btest7 :: Column f String
  , btest8 :: Column f String
  , btest9 :: Column f String
  , btest0 :: Column f String
  , ctest1 :: Column f String
  , ctest2 :: Column f String
  , ctest3 :: Column f String
  , ctest4 :: Column f String
  , ctest5 :: Column f String
  , ctest6 :: Column f String
  , ctest7 :: Column f String
  , ctest8 :: Column f String
  , ctest9 :: Column f String
  , ctest0 :: Column f String
  }
  deriving (Generic, Rel8able)
@seanhess seanhess changed the title Deriving Rel8able extremely slow Rel8able records make app slow to start up Dec 5, 2023
@seanhess
Copy link
Author

seanhess commented Dec 5, 2023

Wait, this gets stranger. I had forgotten to remove all my dependencies from my cabal file when stripping the project down to a reproducible example. This only happens if I also include morpheus-graphql. Here are dependencies that reproduce:

dependencies:
  - base >=4.16.4.0
  - aeson == 2.1.2.1
  - morpheus-graphql-client >= 0.27
  - morpheus-graphql-core
  - morpheus-graphql >= 0.27
  - rel8

Note that Morpheus is not referenced anywhere in the codebase, it's simply listed in the dependencies.

So it only happens when I derive Rel8able AND morpheus is in my dependencies. Any idea what's going on?

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

1 participant