dillonkearns / elm-typescript-interop

Generate TypeScript declaration files for your elm ports!
BSD 3-Clause "New" or "Revised" License
165 stars 13 forks source link

Performance for large projects #16

Open kalawr opened 5 years ago

kalawr commented 5 years ago

Hi Dillon! Thanks for your great work, we are loving the library! We tried applying the elm-typescript-interop to our project (about 21,000 LOC of Elm), which coincidentally uses elm-graphql too, and the time it takes to parse all of these files and produce the output is way beyond practical. Have you run into performance issues yourself with elm-typescript-interop or heard similar stories? Would love to help you get to the bottom of this and contribute. Thanks!

dillonkearns commented 5 years ago

Hello @kalawr! That's great to hear that you're enjoying the library!

I haven't ever run elm-typescript-interop on a project large enough to cause performance issues. I appreciate you reporting the slow performance.

So I've got a few thoughts to explore on how to improve performance here:

Before exploring any of these, it would be really helpful to get some metrics from you so I can understand the problem better.

To start, could you provide me with the following:

Thank you!

Dillon

kalawr commented 5 years ago

Specs: Windows 10, 64-bit; 20 Gb RAM; Intel i7-5600U 2.60 Hz LOC: The project contains 23,251 lines of Elm code (as per cloc). For this particular project we are using Prisma and elm-graphql, which results in a considerable amount (18,081 lines) of auto-generated Elm files. My estimate would be around 15% of all files are not linked to the app import tree. Time: elm-typescript-interop ran for 889.623 s (~15 minutes, benchmarked with ptime) before it exited with an error:

Alias `ValueId` not found. Known aliases:
Api.InputObject.CompanyCreateOneWithoutHierarchiesInputOptionalFields...

However, the project compiles with elm make. Can't run sysconfcpus -n 1 on Windows, sorry. Should I try to look for a workaround? We can give you access to the project repo, if it works for you! Really thankful for your time and willingness to help us out.