String.Join performance issue in C#

后端 未结 6 1530
醉梦人生
醉梦人生 2021-01-11 11:51

I\'ve been researching a question that was presented to me: How to write a function that takes a string as input and returns a string with spaces between the characters. Th

6条回答
  •  孤独总比滥情好
    2021-01-11 12:22

    Since you aren't using the Release build (which should have optimizations checked by default) and/or you're debugging through visual studio then the JITer will be prevented from making a lot of it's optimizations. Because of this you're just not getting a good picture of how long each operation really takes. Once you add in the optimizations you can get the real picture of what's going on.

    It's also important that you not be debugging in visual studio. Go to the bin/release folder and double click the executable entirely outside of visual studio.

提交回复
热议问题