Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
46 stars 19 forks source link

Reduce compilation time by using large-records library #79

Closed thomasbach-dev closed 6 months ago

thomasbach-dev commented 2 years ago

The compilation time of generated client libraries is way too long. There is some work from Edsko de Vries from Well-Typed on this: https://well-typed.com/blog/2021/08/large-records/.

The investigations lead to the large-records package. I have not used the package yet, but it seems like it could give us a dramatic improvement in compilation times.

joel-bach commented 2 years ago

Hey there, I have two lines of thought regarding this:

thomasbach-dev commented 2 years ago

Hi @joelfisch,

Regarding your first point: yes, it is probably best to generate client bindings only for things you really need. But from an end-user perspective there are quite a few hoops to jump. Also, wouldn't it be nice to just generate bindings and be able to publish on Hackage?

ATM I'm not as enthusiastic and optimistic as I was, when I opened the feature request -- the reason for slow compilation times is probably manifold. I am looking at output files from -ddump-simpl and in the Types submodules I see some very huge files. These files are the ones where large records are defined. So, yes, I guess there will be an improvement in compilation time using the large-records library, not sure how much impact it can have, though.

I'll do a quick and dirty implementation to see possible improvements.

joel-bach commented 6 months ago

I'll close this as it has gone stale, let me know if there are any updates on it.