Optimizing components at runtime