ardalis / ardalis/Specification
Consider FastExpressionCompiler for compiling lambda expressions.
- Dominant language
- C#
- Stars
- 2.3k
- Forks
- 262
- PR merge metrics
- No merged PRs in 30d
Description
For the in-memory operations, we're compiling the lambda expressions we have in the spec. The built-in `Expression.Compile()` is quite slow and memory intensive.
The `FastExpressionCompiler` NuGet package offers faster compilation and allocates less memory. For a long time, I've been in doubt whether we should introduce this dependency or not. The hesitation is based on:
- It emits IL code. I'm sure the author has done a great job, but emitting IL is always error prone, too many edge cases (at least in my experience).
- Not all node types are supported. Are we sure these nodes will never be used in our case?
Perhaps we may check and fallback to built-in `Compile`? What is the overhead of all those checks? Anyhow, let's consider this and do some preliminary tests.
Related to #541
Contributor guide
Research direction
Start by locating the in-memory operations that compile lambda expressions in the specification tests, then review related issue #541. Run preliminary comparisons between Expression.Compile() and FastExpressionCompiler, including compilation speed, memory allocation, and supported expression node types. Done means the trade-offs and any fallback behavior are established with test or benchmark results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100