Skip to content

Commit 92ce4b4

Browse files
author
maximv
committed
measuring the Unit and Issue tests invocation time #291
1 parent 3cb56a6 commit 92ce4b4

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/FastExpressionCompiler/FastExpressionCompiler.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5320,6 +5320,28 @@ static ILGeneratorHacks()
53205320

53215321
/// <summary>Efficiently returns the next variable index, hopefully without unnecessary allocations.</summary>
53225322
public static int GetNextLocalVarIndex(this ILGenerator il, Type t) => _getNextLocalVarIndex(il, t);
5323+
5324+
// todo: @perf add MultiOpCodes emit to save on the EnsureCapacity calls
5325+
// todo: @perf create EmitMethod without additional GetParameters call
5326+
/*
5327+
public virtual void EmitCall(OpCode opcode, MethodInfo methodInfo, int paramCount)
5328+
{
5329+
int tk = GetMethodToken(methodInfo, optionalParameterTypes, false);
5330+
EnsureCapacity(7);
5331+
InternalEmit(opcode);
5332+
5333+
int stackchange = 0;
5334+
if (methodInfo.ReturnType != typeof(void))
5335+
stackchange++;
5336+
stackchange -= paramCount;
5337+
if (!methodInfo.IsStatic)
5338+
stackchange--;
5339+
5340+
UpdateStackSize(opcode, stackchange);
5341+
RecordTokenFixup();
5342+
PutInteger4(tk);
5343+
}
5344+
*/
53235345
}
53245346

53255347
internal struct LiveCountArray<T>

test/FastExpressionCompiler.TestsRunner.Net472/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ void Run(Func<int> run, string name = null)
8484
Run(new ValueTypeTests().Run);
8585
Run(new FastExpressionCompiler.LightExpression.UnitTests.NestedLambdasSharedToExpressionCodeStringTest().Run);
8686
Run(new FastExpressionCompiler.LightExpression.UnitTests.LightExpressionTests().Run);
87+
88+
Console.WriteLine($"============={Environment.NewLine}UnitTests are passing in {sw.ElapsedMilliseconds} ms.");
8789
});
8890

8991
var issueTests = Task.Run(() =>
@@ -181,6 +183,8 @@ void Run(Func<int> run, string name = null)
181183

182184
Run(new Issue284_Invalid_Program_after_Coalesce().Run);
183185
Run(new FastExpressionCompiler.LightExpression.IssueTests.Issue284_Invalid_Program_after_Coalesce().Run);
186+
187+
Console.WriteLine($"============={Environment.NewLine}IssueTests are passing in {sw.ElapsedMilliseconds} ms.");
184188
});
185189

186190
Task.WaitAll(unitTests, issueTests);

test/FastExpressionCompiler.TestsRunner/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ void Run(Func<int> run, string name = null)
9090
Run(new ValueTypeTests().Run);
9191
Run(new FastExpressionCompiler.LightExpression.UnitTests.NestedLambdasSharedToExpressionCodeStringTest().Run);
9292
Run(new FastExpressionCompiler.LightExpression.UnitTests.LightExpressionTests().Run);
93+
94+
Console.WriteLine($"============={Environment.NewLine}UnitTests are passing in {sw.ElapsedMilliseconds} ms.");
95+
9396
});
9497

9598
var issueTests = Task.Run(() =>
@@ -191,6 +194,8 @@ void Run(Func<int> run, string name = null)
191194

192195
Run(new Issue284_Invalid_Program_after_Coalesce().Run);
193196
Run(new FastExpressionCompiler.LightExpression.IssueTests.Issue284_Invalid_Program_after_Coalesce().Run);
197+
198+
Console.WriteLine($"============={Environment.NewLine}IssueTests are passing in {sw.ElapsedMilliseconds} ms.");
194199
});
195200

196201
Task.WaitAll(unitTests, issueTests);

0 commit comments

Comments
 (0)