Skip to content

Commit

Permalink
Merge pull request #4 from RocketSurgeonsGuild/feb
Browse files Browse the repository at this point in the history
Added Fast Expression Compiler
  • Loading branch information
david-driscoll authored Feb 21, 2018
2 parents 652657f + 555f6ce commit b53d17d
Show file tree
Hide file tree
Showing 15 changed files with 3,788 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;

Expand Down Expand Up @@ -33,14 +34,14 @@ public Func<object, IServiceProvider, TResult> Compile<TResult>()
{
var (body, parameters) = base.Compile();
var lambda = Expression.Lambda<Func<object, IServiceProvider, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}

public Action<object, IServiceProvider> Compile()
{
var (body, parameters) = base.Compile();
var lambda = Expression.Lambda<Action<object, IServiceProvider>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -33,7 +34,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, TResult
typeof(T8).GetTypeInfo(),
typeof(T9).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9> Compile()
Expand All @@ -49,7 +50,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9> Compi
typeof(T8).GetTypeInfo(),
typeof(T9).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -33,7 +34,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, TR
typeof(T9).GetTypeInfo(),
typeof(T10).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10> Compile()
Expand All @@ -50,7 +51,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10>
typeof(T9).GetTypeInfo(),
typeof(T10).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -34,7 +35,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T1
typeof(T10).GetTypeInfo(),
typeof(T11).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Compile()
Expand All @@ -52,7 +53,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10,
typeof(T10).GetTypeInfo(),
typeof(T11).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -30,7 +31,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T1
typeof(T11).GetTypeInfo(),
typeof(T12).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Compile()
Expand All @@ -49,7 +50,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10,
typeof(T11).GetTypeInfo(),
typeof(T12).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand All @@ -24,15 +25,15 @@ public Func<object, IServiceProvider, T, TResult> Compile<TResult>()
var (body, parameters) = base.Compile(
typeof(T).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}

public Action<object, IServiceProvider, T> Compile()
{
var (body, parameters) = base.Compile(
typeof(T).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand All @@ -25,7 +26,7 @@ public Func<object, IServiceProvider, T, T2, TResult> Compile<TResult>()
typeof(T).GetTypeInfo(),
typeof(T2).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}

public Action<object, IServiceProvider, T, T2> Compile()
Expand All @@ -34,7 +35,7 @@ public Action<object, IServiceProvider, T, T2> Compile()
typeof(T).GetTypeInfo(),
typeof(T2).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -26,7 +27,7 @@ public Func<object, IServiceProvider, T, T2, T3, TResult> Compile<TResult>()
typeof(T2).GetTypeInfo(),
typeof(T3).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}

public Action<object, IServiceProvider, T, T2, T3> Compile()
Expand All @@ -36,7 +37,7 @@ public Action<object, IServiceProvider, T, T2, T3> Compile()
typeof(T2).GetTypeInfo(),
typeof(T3).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -27,7 +28,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, TResult> Compile<TResult>()
typeof(T3).GetTypeInfo(),
typeof(T4).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4> Compile()
Expand All @@ -38,7 +39,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4> Compile()
typeof(T3).GetTypeInfo(),
typeof(T4).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -29,7 +30,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, TResult> Compile<TResul
typeof(T4).GetTypeInfo(),
typeof(T5).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5> Compile()
Expand All @@ -41,7 +42,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5> Compile()
typeof(T4).GetTypeInfo(),
typeof(T5).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -29,7 +30,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, TResult> Compile<TR
typeof(T5).GetTypeInfo(),
typeof(T6).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6> Compile()
Expand All @@ -42,7 +43,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6> Compile()
typeof(T5).GetTypeInfo(),
typeof(T6).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -31,7 +32,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, TResult> Compil
typeof(T6).GetTypeInfo(),
typeof(T7).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7> Compile()
Expand All @@ -45,7 +46,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7> Compile()
typeof(T6).GetTypeInfo(),
typeof(T7).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7>>(lambda);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using FastExpressionCompiler;
using System;
using System.Collections.Immutable;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -32,7 +33,7 @@ public Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, TResult> Co
typeof(T7).GetTypeInfo(),
typeof(T8).GetTypeInfo());
var lambda = Expression.Lambda<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, TResult>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Func<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8, TResult>>(lambda);
}

public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8> Compile()
Expand All @@ -47,7 +48,7 @@ public Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8> Compile()
typeof(T7).GetTypeInfo(),
typeof(T8).GetTypeInfo());
var lambda = Expression.Lambda<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8>>(body, parameters);
return lambda.Compile();
return ExpressionCompiler.CompileFast<Action<object, IServiceProvider, T, T2, T3, T4, T5, T6, T7, T8>>(lambda);
}
}
}
Loading

0 comments on commit b53d17d

Please sign in to comment.