The combination of both is usually optimal.
- Investing in deterrence is cost effective... up to a point.
- Directly sending Ukraine arms is cost effective... up to a point.
Right now, it's fair to say that (relative to Russia) Europe has been underinvesting in defense for a couple decades.
Good news: they seem to have recognized this and invested in recapitalizing their industrial defense base.