Although more general than some other tips, here is mine:
When using a large number of "elements", try to avoid creating a control for each of them, and not to reuse the controls. For example, if you have 10,000 elements, each of which corresponds to a button, it is very simple (programmatically) to create 10,000 buttons and connect their event handlers so that when you enter the event handler you know exactly which element you should work with. However, this is much more efficient if you create, say, 500 buttons (because you know that only 500 buttons will be displayed on the screen) and enter a โdisplay layerโ between the buttons and the elements that dynamically reassign the buttons to different elements every time the user does something that will change the set of buttons that should be visible (for example, moving the scroll bar).
source share