Depends on the programming language. A good question is why we don't have more optimizable languages in mainstream use.
Are there any programming languages which change the data layout beyond naively sorting struct members by alignment? (which at best helps with reducing padding bytes but can be either good or bad for performance, depending on the code which accesses the data).
FORTRAN is used for a lot of numerical algorithms - today! installed on your computer right now in some library! - because it optimizes better than C because it doesn't have pointers.