Of memory and strings
This post was provoked by a recent Stack Overflow question which asked whether there was an efficient representation of ASCII strings in .NET. In particular, the questioner wanted to story hundreds of thousands – possibly millions – of strings in memory, and knowing (or assuming) that they all consisted of ASCII characters, he wanted to avoid the waste of space that comes from storing each character in a .NET string as a UTF-16 code unit. My answer to the question mostly consisted of saying that I didn’t think it would be worth the effort, and giving some reasons. But the … Continue reading Of memory and strings