Skip to content

performance: skip ToString with interpolated string #2175

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Dapper/DynamicParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static void ThrowInvalidChain()
if (setter is not null) goto MAKECALLBACK;

// Come on let's build a method, let's build it, let's build it now!
var dm = new DynamicMethod("ExpressionParam" + Guid.NewGuid().ToString(), null, new[] { typeof(object), GetType() }, true);
var dm = new DynamicMethod($"ExpressionParam{Guid.NewGuid()}", null, new[] { typeof(object), GetType() }, true);
var il = dm.GetILGenerator();

il.Emit(OpCodes.Ldarg_0); // [object]
Expand Down
4 changes: 2 additions & 2 deletions Dapper/SqlMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2565,7 +2565,7 @@ private static bool IsValueTuple(Type? type) => (type?.IsValueType == true
filterParams = !CompiledRegex.LegacyParameter.IsMatch(identity.Sql);
}

var dm = new DynamicMethod("ParamInfo" + Guid.NewGuid().ToString(), null, [typeof(IDbCommand), typeof(object)], type, true);
var dm = new DynamicMethod($"ParamInfo{Guid.NewGuid()}", null, [typeof(IDbCommand), typeof(object)], type, true);

var il = dm.GetILGenerator();

Expand Down Expand Up @@ -3321,7 +3321,7 @@ private static Func<DbDataReader, object> GetTypeDeserializerImpl(
}

var returnType = type.IsValueType ? typeof(object) : type;
var dm = new DynamicMethod("Deserialize" + Guid.NewGuid().ToString(), returnType, [typeof(DbDataReader)], type, true);
var dm = new DynamicMethod($"Deserialize{Guid.NewGuid()}", returnType, [typeof(DbDataReader)], type, true);
var il = dm.GetILGenerator();

if (IsValueTuple(type))
Expand Down