Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was wondering if someone has noted any performance issue or memory improvement by setting the GenerateMember variable to false.

As far as i have seen, what it does is just declare the variable locally inside InitializeComponent() stub, so i guess that this variable would be able to be collected by GC and cleaned after used. would this improve performance or memory allocation?

For instance, a good use of this would be if you have a long list of menu items in a menu strip, and you just need to handle their click event and never access any of their properties in runtime. But, will it work the sacrifice ?

What are your thought regarding this?
Posted

I always mean to remember to set it to False for controls I don't access in code (which is usually the majority of them). I don't think it would affect performance in any noticeable way.

Comparing to WPF, with MVVM it's rare that anyone will ever need to name their controls (except for styles, templates etc.)

So if you prefer to set them to False, go ahead, it won't affect anything, and you will get rid of some superfluous member variables in the auto generated code.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 28-Jan-11 14:35pm    
I think you're right.
--SA
I think if your computer is so slow that this would make a difference, you need to trade it in on an abacus.
 
Share this answer
 
Comments
creizlein 28-Jan-11 14:07pm    
Sorry to say this way, but how does the computer slowness apply into this? performance and memory allocation exist no matter you have a 50 cores CPU with 50gb ram or just a pentium with 2gb...

if you don't notice the performance or you don't care if a program uses more or less memory because you have "good enough" then thats another story
#realJSOP 28-Jan-11 14:38pm    
Because a slow computer is more apt to shine a light on slow processes. On fast computers, even the crappiest code can run like the blazes.
creizlein 28-Jan-11 14:50pm    
Thats correct, there is no doubt about that, but as i mentioned, that means you are just "ignoring" the performance issue, but its still there...
Your car can run without problems as prolly as fast as usual with the truck loaded of bricks, if it has a good engine, but that doesn't mean you are doing it right ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900