-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fast expression compiler #3103
Fast expression compiler #3103
Conversation
A lot of tests fail. |
Looks like we're getting a lot of |
It's possible to see the generated IL in VS using an extension. But generating the right IL, not so simple :) |
@jbogard, first identify what tests are failing. Try to isolate and minimize the expressions used in these tests. Test them with FEC. I will look when I have time. I remember, that I had a fork with FEC for MediatR maybe a 2 years old. The tests were passing at the end. |
@dadhi lol did you? I guess I do have a bit of |
@dadhi I made a very simple mapping to show the problem. Here's the test: using Shouldly;
using Xunit;
namespace AutoMapper.UnitTests.Bug
{
public class FastExpressionCompilerBug
{
public class Source
{
public int Value { get; set; }
}
public class Dest
{
public int Value { get; set; }
}
[Fact]
public void ShouldWork()
{
var config = new MapperConfiguration(cfg => cfg.CreateMap<Source, Dest>());
var mapper = config.CreateMapper();
var expression = mapper.ConfigurationProvider.BuildExecutionPlan(typeof(Source), typeof(Dest));
var source = new Source {Value = 5};
var dest = mapper.Map<Dest>(source);
dest.Value.ShouldBe(source.Value);
}
}
} And here's the expression (from ReadableExpressions.Visualizer):
|
And here's the debug view:
|
See also: dadhi/FastExpressionCompiler#197 |
Hi @jbogard The cases reported in dadhi/FastExpressionCompiler#196 and dadhi/FastExpressionCompiler#197 Here is the clue about performance (the latest FEC master) using the expression from dadhi/FastExpressionCompiler#196 Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op |
------------------------------------------- |-----------:|----------:|----------:|------:|--------:|------------:|------------:|------------:|--------------------:|
Compile | 254.985 us | 3.9906 us | 3.7328 us | 28.47 | 0.56 | 1.9531 | 0.9766 | - | 10.93 KB |
CompileFast | 11.032 us | 0.0558 us | 0.0522 us | 1.23 | 0.01 | 0.6256 | 0.3052 | 0.0305 | 2.91 KB |
CompileFast_LightExpression | 8.961 us | 0.0921 us | 0.0769 us | 1.00 | 0.00 | 0.6256 | 0.3052 | 0.0305 | 2.91 KB |
CompileFast_WithoutClosure | 9.530 us | 0.0917 us | 0.0858 us | 1.06 | 0.01 | 0.6256 | 0.3052 | 0.0305 | 2.88 KB |
CompileFast_LightExpression_WithoutClosure | 8.024 us | 0.0447 us | 0.0349 us | 0.90 | 0.01 | 0.6256 | 0.3052 | 0.0305 | 2.88 KB | |
@dadhi Nice! |
dbffcf7
to
3447e31
Compare
…ionCompiler # Conflicts: # src/AutoMapper/ExpressionExtensions.cs
Fast expression compiler
Yikes. Still tons of test failures:
|
Sad.. The problem is that expressions are complex and composed in a different places, so I need |
Meh. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The tests fail though.