-
Notifications
You must be signed in to change notification settings - Fork 297
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 #778 | persistent-template - Add persistManyFileWith
#791
Conversation
qRunIO $ SIO.hSetEncoding h SIO.utf8_bom | ||
s <- qRunIO $ TIO.hGetContents h | ||
ss <- mapM getS fps | ||
let s = mconcat ss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed a minor hiccup when playing with this. Should any of the Entity
files be missing a line-break at the EOF, then we end up gluing them wrong. Ex:
- Foo/Entity
Foo
name Text
age Natural
- Bar/Entity
Bar
title Text
- currently will be read as:
Foo
name Text
age NaturalBar
title Text
Should this be updated to T.intercalate "\n" ss
to be fault tolerant? Or should we leave it as is and just document that all files must end with a line break (since it is a common convention anyway)?
I’m strongly in favor of the fault tolerant approach—it’s great when everything just works! |
@naushadh You don't have to, but any chance you can confirm that this solves memory usage issues? It'd be nice to point to a solution for the people with 30GB compiles. |
@MaxGabriel I tried to reproduce it with my sample project naushadh/persistent-examples/model-organization with 20 entities, but I see ~160MB of memory usage for all cases:
Do you have a sample repo/gist/snippet handy that can repro the multi GB compile issue? I can try breaking it apart component style to see if it makes it go away. |
@naushadh So I created ~30 models, each deriving I tried using both a single model file and split across 3 model files, but the compile time and memory usage are pretty similar for me (~85 seconds, ~950 MB to compile). I'm compiling with |
@MaxGabriel the repo didn't actually utilize the new API Stats
Tricks (since we aren't actually saving much memory)
Edit: fixed typos. |
Ah ok great. I had used I made a PR to your branch adding an example to the documentation: naushadh#3 Otherwise I think this is ready to merge. One final thought: How do you feel about the name? I'm constantly having to look up |
Document persistManyFileWith
Docs look beautiful! Much easier to consume than following 3 levels of urls. Yeah I thought the same, so I went with convention. I'm open to suggestions. |
Ok, released on hackage! Thanks for your work on this, it'll be great to point Persistent users to this solution |
Address persistent#778.
Before submitting your PR, check that you've:
@since
declarations to the HaddockAfter submitting your PR: