FSharp.Data.GraphQL icon indicating copy to clipboard operation
FSharp.Data.GraphQL copied to clipboard

Is it possible to improve performance of client project build if it uses type provider

Open xperiandri opened this issue 4 years ago • 7 comments

Description

Building integration tests (the project that uses type provider) take 02:35. Is it possible to do any performance optimization to reduce that time? Ideally 3-5 times 🙂

Related information

  • Visual Studio 2019 16.8
  • FSharp.Data.GraphQL.Client 1.0.6
  • .NET Core SDK 5.0.1

xperiandri avatar Dec 28 '20 00:12 xperiandri

https://github.com/dotnet/fsharp/issues/11222

xperiandri avatar Mar 12 '21 12:03 xperiandri

@ivelten, @bddckr, @jberzy, what do you think regarding the answer on dotnet/fsharp?

xperiandri avatar Mar 12 '21 14:03 xperiandri

AFAIK (and I've only contributed a tiny change to this project) the generated types are all cached here: https://github.com/fsprojects/FSharp.Data.GraphQL/blob/ddea9b4edab1bdc25041f82fef513086052065f9/src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs#L934

bddckr avatar Mar 12 '21 16:03 bddckr

@xperiandri It might be due to the combinations the TP produces when an operation has a lot of optional parameters. Try upgrading to the latest version and set explicitOptionalParameters to true. When set to true, the TP does not generate a method for all combinations of an operation, but you need to pass Some/None for each optional parameter explicitly.

https://github.com/fsprojects/FSharp.Data.GraphQL/pull/312/files#diff-a5a18b7a9d2321fa581906574b53bd7d6148e1f6253c389c624ce3baa81e09f4R10

jberzy avatar Mar 12 '21 17:03 jberzy

With explicitOptionalParameters = true nothing radically changed. Now time is 2:05-2:15 instead of 2:35-3:15. Even adding an empty line in a source code causes a full new build that takes around 2 minutes.

xperiandri avatar Mar 12 '21 23:03 xperiandri

At least IntelliSense and navigate to definition became instantly responsive

xperiandri avatar Mar 12 '21 23:03 xperiandri

So the responsiveness is better but not as good as it must be (as it is with the unloaded project that uses type provider). And build time is still too long. And still, if I change anything in the project build starts again from scratch and takes the same time as the first time. I mean build of the project that contains the client provider.

xperiandri avatar Mar 22 '21 15:03 xperiandri