dotnet / dotnet/fsharp

Reduce memory footprint and improve performance of expression-based ORM usage

Open
#10,522 0 comments 1 reaction 0 assignees View on GitHub
Area-Compiler-Optimization Feature Improvement Impact-Low Theme-Performance
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

**Repro steps**

1. clone https://github.com/bessgeor/benchmark-fsharp-csharp-query-building
2. run `dotnet tools restore`
3. run `cd ./BuildQuery.Benchmark`
4. run `dotnet publish -c Release -m`
5. run `dotnet ./bin/Release/netcoreapp3.1/publish/BuildQuery.Benchmark.dll`

**Expected behavior**

F#'s performance is slighly lower than C#'s because of Quotation->Expression conversion

**Actual behavior**

F# is 6x times slower (~0.65ms more per call) and allocates 10x times more (~453 KiB more per call)

**Known workarounds**

[Query compilation](https://linq2db.github.io/api/LinqToDB.CompiledQuery.html#methods) may move this costs to startup time, but it's blocked by #2758 and may not be used on every query.

**Related information**

Provide any related information (optional):

* OS Windows 10.0.19041.630
* .NET Runtime .NET Core 3.1.5 (CoreCLR 4.700.20.26901, CoreFX 4.700.20.27001)
* Editor Rider 16.2.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.