Rely on the compiler to provide the required performance.
Be sure to know which optimisations are guaranteed by the compiler and at which optimisation levels, and use them liberally. And even if performance isn't a concern requirement, you can still test with optimisations on, and then only discount one character because your code is still technically valid without the compiler flag.
Consider the following Haskell function to compute 2^n (ignoring the fact that Haskell already has a built-in exponentiation operator or three) (23 characters):
p 0=1;p x=p(x-1)+p(x-1)
The problem is - it's horrendously slow, it runs in exponential time. This might make your code untestable or to fail any performance constraints given by the question. You might be tempted to use a temporary variable or an immediately invoked function literal to avoid repeated function calls (25 characters):
p 0=1;p x=(\y->y+y)$p$x-1
But the compiler can already do that for you, you just need set -O
as a compiler flag! Instead of spending few extra characters per site to eliminate common subexpressions manually, just tell the compiler to do basic optimisations for you for a grand total of one character or two across the entire program.