-
Notifications
You must be signed in to change notification settings - Fork 94
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
Faster CodeGenerator if FSHARP6 defined #407
base: master
Are you sure you want to change the base?
Conversation
This is helping generative TPs (like FSharp.Data and SwaggerProvider) but not erasing providers (like SQLProvider). |
Because most of the TPs still refer ProvidedTypes.fs as a paket-dependencies file, not as NuGet package, the DefineConstants can be defined in the project referring the file.
We still need a maintenance path for TPs. The current code is old and could be improved. But here, recent 6 weeks you can see that people still use mostly F# 5 and not the latest one. So maybe we need 2 versions? What is a way to separate them, same file, different file, is a political choice not interesting to me.
Yeah, right, try the script, it'll complete in a minute (or multiple if you don't have i9 laptop): #r "nuget: SwaggerProvider"
let [<Literal>] Schema = "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.sdk.json";;
let t = System.DateTime.Now;; //#time didn't give correct results so let's use the old way...
type Stripe = SwaggerProvider.OpenApiClientProvider<Schema, PreferAsync = true>;;
printfn "%f" (System.DateTime.Now-t).TotalSeconds;; |
I think there's a separate discussion to be had about if the base dependency should be FSharp.Core 6 or not. I lean towards that as a reasonable choice. But it seems preprocessors are out. |
How does it compare to the changed one? Also, it does involve a bunch of IO, probably better to compare to the already downloaded json. With local json it runs for 59-ish seconds on my machine. |
Would you accept preprocessors at fsproj-level? So that there would be ProvidedTypesOld.fs and ProvidedTypesNew.fs ? I think lot of F# 4 usage comes from the misunderstanding that the recent F# wouldn't support .NET Framework, and I think .NET Framework is still widely used.
It's all ProvidedTypes.fs that seems to take the time, and there is a lot of work to do here. I'm not hoping to get this instant, but if that could be dropped to let's say to 10 seconds, it would also speed-up all the other TPs correspondingly. This PR was not meant to be the full solution, it's just me testing if PRs are accepted, then I'll continue the work :-) |
By accepting a dependency to System.Memory in .NET Standard 2.0 (only) we'd get access to |
One option for #405
I was testing SwaggerProvider performance issue of fsprojects/SwaggerProvider#150 (comment)
and even though still way too slow, this did gain a few seconds faster execution.