Commit 920ea64
authored
[Java.Interop] optimize JniTypeManager.AssertSimpleReference() (#1001)
We noticed `dotnet trace` output was showing:
21.28ms (0.45%) java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)
This code path was introduced by a new feature in 1f27ab5.
For now, I think we can rewrite this to use the
[`string.IndexOf(char)`][0] overload of `string.IndexOf()`, as well
as the `string` indexer instead of `string.StartsWith()` and
`string.EndsWith()`.
After these changes, I get a better time:
1.21ms java.interop!Java.Interop.JniRuntime.JniTypeManager.AssertSimpleReference(string,string)
We may have just *moved* the location that ICU is loaded, but this
change is good regardless.
[0]: https://docs.microsoft.com/en-us/dotnet/api/system.string.indexof?view=net-6.0#system-string-indexof(system-char)1 parent 4b4fedd commit 920ea64
1 file changed
+12
-6
lines changedLines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
| |||
0 commit comments