Conversation
| <#@ template debug="true" hostSpecific="true" #> | ||
| <#@ output extension=".cs" #> | ||
| <# | ||
| string[] internNames = new string[] |
There was a problem hiding this comment.
Why use a template generator, when you can simply get internNames from reflection? It looks like unnecessary complication.
There was a problem hiding this comment.
Two reasons make this scenario happened.
- You need to make sure the string is a c# intern string too to make code like this work without extra checking
const string s = "1";
switch (
case "1":
// both "1" point to the same string
break;- If you need (1), you have to make the
internNamesset on compile.
Of course, if you don't (1), internNames can just set by using reflection from readingPyIdentities.
49e3340 to
021bf9f
Compare
021bf9f to
955ef8d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1254 +/- ##
=======================================
Coverage 86.25% 86.25%
=======================================
Files 1 1
Lines 291 291
=======================================
Hits 251 251
Misses 40 40
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
|
@amos402 did you have a chance to compare benchmarks on your branch with |
|
https://gist.github.com/amos402/8decd54dee57fe654e098bc0b15c061a CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
|
What does this implement/fix? Explain your changes.
Use the intern strings map to const strings instead of creating temporary strings everytimes.
Checklist
Check all those that are applicable and complete.
AUTHORSCHANGELOG