-
Notifications
You must be signed in to change notification settings - Fork 830
Closed
Milestone
Description
String.Concat is called multiple times in a row for 3 and 4 strings despite overloads taking these numbers of params are available.
3 strings:
let s a b =
a + "." + bIL_0000: ldarg.0 // a
IL_0001: ldstr "."
IL_0006: call string [System.Runtime]System.String::Concat(string, string)
IL_000b: ldarg.1 // b
IL_000c: call string [System.Runtime]System.String::Concat(string, string)
IL_0011: ret
4 strings:
let s1 a b c =
a + "." + b + cIL_0000: ldarg.0 // a
IL_0001: ldstr "."
IL_0006: call string [System.Runtime]System.String::Concat(string, string)
IL_000b: ldarg.1 // b
IL_000c: call string [System.Runtime]System.String::Concat(string, string)
IL_0011: ldarg.2 // c
IL_0012: call string [System.Runtime]System.String::Concat(string, string)
IL_0017: ret
And the same in C#:
public static string S(string a, string b) => a + "." + b;IL_0000: ldarg.0 // a
IL_0001: ldstr "."
IL_0006: ldarg.1 // b
IL_0007: call string [netstandard]System.String::Concat(string, string, string)
IL_000c: ret
public static string S2(string a, string b, string c) => a + "." + b + c;IL_0000: ldarg.0 // a
IL_0001: ldstr "."
IL_0006: ldarg.1 // b
IL_0007: ldarg.2 // c
IL_0008: call string [netstandard]System.String::Concat(string, string, string, string)
IL_000d: ret
Metadata
Metadata
Assignees
Labels
No labels