Skip to content

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

@bessgeor

Description

@bessgeor

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 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions