Skip to content
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

Update #397 to fix conflicts #473

Merged
merged 4 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="ExpressionDebugger" Version="2.2.1" />
<PackageReference Include="ExpressionTranslator" Version="2.5.0" />
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="Expressmapper" Version="1.9.1" />
<PackageReference Include="FastExpressionCompiler" Version="3.1.0" />
<PackageReference Include="FastExpressionCompiler" Version="3.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExpressionDebugger\ExpressionDebugger.csproj" />
<ProjectReference Include="..\ExpressionTranslator\ExpressionTranslator.csproj" />
<ProjectReference Include="..\Mapster\Mapster.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Benchmark/Benchmarks/TestAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public void SetupFec()
[GlobalSetup(Target = nameof(CodegenTest))]
public void SetupCodegen()
{
_fooInstance = TestAdaptHelper.SetupFooInstance();
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
FooMapper.Map(_fooInstance);
CustomerMapper.Map(_customerInstance);
//_fooInstance = TestAdaptHelper.SetupFooInstance();
//_customerInstance = TestAdaptHelper.SetupCustomerInstance();
//FooMapper.Map(_fooInstance);
//CustomerMapper.Map(_customerInstance);
}

[GlobalSetup(Target = nameof(ExpressMapperTest))]
Expand Down
4 changes: 2 additions & 2 deletions src/Benchmark/Benchmarks/TestComplexTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public void SetupFec()
[GlobalSetup(Target = nameof(CodegenTest))]
public void SetupCodegen()
{
_customerInstance = TestAdaptHelper.SetupCustomerInstance();
CustomerMapper.Map(_customerInstance);
//_customerInstance = TestAdaptHelper.SetupCustomerInstance();
//CustomerMapper.Map(_customerInstance);
}

[GlobalSetup(Target = nameof(ExpressMapperTest))]
Expand Down
4 changes: 2 additions & 2 deletions src/Benchmark/Benchmarks/TestSimpleTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public void SetupFec()
[GlobalSetup(Target = nameof(CodegenTest))]
public void SetupCodegen()
{
_fooInstance = TestAdaptHelper.SetupFooInstance();
FooMapper.Map(_fooInstance);
//_fooInstance = TestAdaptHelper.SetupFooInstance();
//FooMapper.Map(_fooInstance);
}

[GlobalSetup(Target = nameof(ExpressMapperTest))]
Expand Down
10 changes: 5 additions & 5 deletions src/Benchmark/TestAdaptHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void ConfigureMapster(Foo fooInstance, MapsterCompilerType type)
}
public static void ConfigureExpressMapper(Foo fooInstance)
{
ExpressMapper.Mapper.Map<Foo, Foo>(fooInstance); //exercise
//ExpressMapper.Mapper.Map<Foo, Foo>(fooInstance); //exercise
}
public static void ConfigureAutoMapper(Foo fooInstance)
{
Expand All @@ -103,7 +103,7 @@ public static void ConfigureMapster(Customer customerInstance, MapsterCompilerTy
}
public static void ConfigureExpressMapper(Customer customerInstance)
{
ExpressMapper.Mapper.Map<Customer, CustomerDTO>(customerInstance); //exercise
//ExpressMapper.Mapper.Map<Customer, CustomerDTO>(customerInstance); //exercise
}
public static void ConfigureAutoMapper(Customer customerInstance)
{
Expand All @@ -121,7 +121,7 @@ public static void TestExpressMapper<TSrc, TDest>(TSrc item, int iterations)
where TSrc : class
where TDest : class, new()
{
Loop(item, get => ExpressMapper.Mapper.Map<TSrc, TDest>(get), iterations);
//Loop(item, get => ExpressMapper.Mapper.Map<TSrc, TDest>(get), iterations);
}

public static void TestAutoMapper<TSrc, TDest>(TSrc item, int iterations)
Expand All @@ -133,12 +133,12 @@ public static void TestAutoMapper<TSrc, TDest>(TSrc item, int iterations)

public static void TestCodeGen(Foo item, int iterations)
{
Loop(item, get => FooMapper.Map(get), iterations);
//Loop(item, get => FooMapper.Map(get), iterations);
}

public static void TestCodeGen(Customer item, int iterations)
{
Loop(item, get => CustomerMapper.Map(get), iterations);
//Loop(item, get => CustomerMapper.Map(get), iterations);
}

private static void Loop<T>(T item, Action<T> action, int iterations)
Expand Down
15 changes: 15 additions & 0 deletions src/ExpressionDebugger.Console/ExpressionDebugger.Console.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<UseNETCoreGenerator>true</UseNETCoreGenerator>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\ExpressionDebugger\ExpressionDebugger.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="untitled.cs" />
</ItemGroup>
</Project>
26 changes: 26 additions & 0 deletions src/ExpressionDebugger.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Linq.Expressions;

namespace ExpressionDebugger.Console
{
class Program
{
static void Main(string[] args)
{
var p1 = Expression.Parameter(typeof(int));
var p2 = Expression.Parameter(typeof(int));
var body = Expression.Add(p1, Expression.Block(
new Expression[] {
Expression.Call(typeof(System.Console).GetMethod("WriteLine", new [] { typeof(int) }), p2),
p2,
}));
var lambda = Expression.Lambda<Func<int, int, int>>(body, p1, p2);

var script = lambda.ToScript();

var fun = lambda.CompileWithDebugInfo();
var result = fun(1, 2);
System.Console.WriteLine(result);
}
}
}
Loading