what are all the Optimize tricks that you know for asp.net code ?

Posted by Aristos on Stack Overflow See other posts from Stack Overflow or by Aristos
Published on 2010-03-22T13:34:04Z Indexed on 2010/03/22 13:51 UTC
Read the original article Hit count: 259

Filed under:
|
|
|

After some time of many code programming on asp.net, I discover the very big speed different between string and StringBuilder.

I know that is very common and known but I just mention it for start.

The second think that I have found to speed up the code, is to use the const, and not the static, for declare my configuration constants value (especial the strings). With the const, the compiler not create new object, but just place the value, on the point that you have ask it, but with the static declaration, is create a new memory object and keep its on the memory.

My third trick, is when I search for string, I use hash values, and not the string itself. For example, if I need a List<string> SomeValues, and place inside strings that I need to search them, I prefer to use List<int> SomeHashValue, and I use the hash value to locate the strings.

My forth thought that I was wandering, is if is better to place big strings in one line, or separate them in different lines with the + symbol to be more easy to read out. I make some tests and see that the compiler make a good job is some split the string, in many lines, using the + symbol.

What other tricks/tips do you know and use on your programming to make it run faster, and maybe use less memory.

Well I know, that some times, to make something run faster, you need more memory, more cache. My priority is on speed.

Because Speed Counts.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#