fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
814 stars 288 forks source link

Small memory and performance optimization: Less nested seq-wrapping on recursive functions #1511

Closed Thorium closed 2 months ago

Thorium commented 3 months ago

Small memory and performance optimization:

As a side note: There are some cases where FSharp.Data does some manual recursive string-parsing-functions. More could be done on those: If we'd accept a new dependency to System.Memory on .NET Standard 2.0 version, we'd get .AsSpan and ReadOnlySpan<char> which could be used to gain speed and save memory (especially on .NET Standard 2.1 where those are available out-of-the-box and System.Memory reference is not needed).

cartermp commented 2 months ago

If you run dotnet fake build -t Format then it should probably pass CI

Thorium commented 2 months ago

Thanks, done, I didn't know Fantomas had infected this repo as well.

Thorium commented 2 months ago

I'd also like to get this change for FSharp.Data now that it's F# 6: https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/407

cartermp commented 2 months ago

Mmm, this change causes a stack overflow when generating docs. Could you investigate? https://github.com/fsprojects/FSharp.Data/actions/runs/9828724527/job/27132994427?pr=1511#step:6:1748

Thorium commented 2 months ago

Ok, fixed. The docs were actually nice edge-case unit-tests. :-)