Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bfarmer67 committed Dec 14, 2024
1 parent f9de913 commit e68cdc9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Hyperbee.Expressions/Transformation/AwaitBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ internal AwaitBinder(
GetResultImplDelegate = getResultImplDelegate;

// Pre-jit methods and delegates
// This saves a little time when the methods are called for the first time
// This saves a little time when the methods are executed for the first time

RuntimeHelpers.PrepareMethod( WaitMethod.MethodHandle );
RuntimeHelpers.PrepareMethod( GetAwaiterMethod.MethodHandle );
Expand All @@ -45,7 +45,7 @@ internal AwaitBinder(
RuntimeHelpers.PrepareDelegate( getResultImplDelegate );
}

// Await methods
// Wait methods

[MethodImpl( MethodImplOptions.AggressiveInlining )]
internal void Wait<TAwaitable, TAwaiter>( ref TAwaitable awaitable, bool configureAwait )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ private static List<ConstantExpression> GetNestedTestValues( StateContext.Scope

return testCases;
}

}
2 changes: 1 addition & 1 deletion src/Hyperbee.Expressions/Transformation/LoweringVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected override Expression VisitBlock( BlockExpression node )
previousVariable = updated.Result.Variable;
joinState.Result.Variable = previousVariable;

// Fix tail link list of Transitions.
// Fix tail linked list of Transitions.
if ( previousTail != null )
previousTail.Transition = new GotoTransition { TargetNode = updated };

Expand Down
5 changes: 2 additions & 3 deletions src/Hyperbee.Expressions/Transformation/ReflectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ internal static MethodInfo FindExtensionMethod( Type targetType, string methodNa
{
// Search for an extension method with the specified name that extends the specified target type.
//
// Extension searching is a very expensive operation. To minimize the performance impact, we
// will search in a specific order to try and reduce the number of assemblies that need to be
// searched.
// Extension searching is an expensive operation. To minimize the performance impact, we will
// search in a specific order to try and reduce the number of assemblies that need to be searched.
//
// The search order is:
//
Expand Down
4 changes: 1 addition & 3 deletions src/Hyperbee.Expressions/Transformation/StateContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ internal sealed class StateContext

private readonly Stack<StateNode> _joinStates;
private readonly Stack<int> _scopeIndexes;

public List<Scope> Scopes { get; }

public StateNode TailState { get; private set; }

private Scope CurrentScope => Scopes[_scopeIndexes.Peek()];

public StateContext( int initialCapacity )
Expand Down Expand Up @@ -184,5 +183,4 @@ static bool IsDefaultVoid( Expression expression )
}

public readonly record struct JumpCase( LabelTarget ResultLabel, int StateId, int? ParentId );

}
22 changes: 11 additions & 11 deletions test/Hyperbee.Expressions.Benchmark/AsyncBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ public async Task DotNext_AsyncLambda_Execute()

// Helpers

public static async Task<int> NativeTestAsync()
{
var variable = await InitVariableAsync();
if ( await IsTrueAsync() )
{
variable = await AddAsync( variable, variable );
}

return variable;
}

public static Task<int> InitVariableAsync()
{
return Task.FromResult( Random.Shared.Next( 0, 10 ) );
Expand All @@ -188,15 +199,4 @@ public static Task<int> AddAsync( int a, int b )
{
return Task.FromResult( a + b );
}

public static async Task<int> NativeTestAsync()
{
var variable = await InitVariableAsync();
if ( await IsTrueAsync() )
{
variable = await AddAsync( variable, variable );
}

return variable;
}
}

0 comments on commit e68cdc9

Please sign in to comment.