Q: Should I save, invest, or pay off my student loans?

A: Student loans are draining, both financially and psychologically. Paying them off early feels good. Not that I'd know: I'm making the minimum payments on mine.

That's a calculated decision because I prioritize the three things — saving, investing and paying off student loans — in exactly the order you listed them. Here's why:

A little money in the bank goes a long way. Ever look out the window during a rainstorm to find that the roof on your front porch has turned into a waterfall? Tried to replace a light fixture only to realize that your 100-year-old house has 100-year-old wiring? I have, and I can tell you that an emergency fund will come in handy in these and many other situations. If you've sent all available cash to your student loan provider, they're not going to be super receptive when you call to ask for it back.

Aim to get enough money in the bank to make you feel comfortable for now, but not so much that it kicks your other goals down the road for years. If all you can afford to put aside right now is $500, that is enough to get you out of many common jams.

Investing for retirement comes next. The people who triumph over their student loans and live to write about it frequently do so at the expense of investing for the future. In reading 20 or so accounts of student loan debt wiped clean, only two or three even mentioned saving or investing.

This is a mistake. When you're young, your money might have 40 years to grow. You can save less and rely more on investment returns thanks to compound interest.

Then there's the math: When you pay off your student loans faster than you have to, you're essentially earning a return that is roughly equal to the interest you don't pay. If your interest rate is, say, 4.5 percent, you earned a 4.5 percent return by skipping out on that interest.

Compare that with the average annual return of a long-term investment portfolio, the kind you might build in a retirement plan. History says 6 to 7 percent is a fair expectation. This is true if you're investing in an IRA, and it's especially true if you have a 401(k) with matching dollars.

Even if your loans are closer to the nearly 7 percent top rate range over the last decade, or you have private loans that are even higher, you should get that match before you pay more than the minimum toward those loans.

Once you're on track for retirement, you're free to knock down those student loans all you want.

Arielle O'Shea is a staff writer at NerdWallet, a personal finance website.