Memory vs. Speed

I'm making a BlackJack game in SDL. The cards in this game are generated using a 'front-card background', the symbols of the four colors (hearts, spades, diamonds and clubs) and a surface with the name (2/10, Jack, Queen, King, Ace), wich is generated using TTF_RenderText_Solid() at the moment it's needed.

What is the best way to generate those cards? I could generate all the surfaces at the beginning of the program, or the first time when they're needed, wich would take some memory. In the end, I would have 52 surfaces in memory. I could also create a function show(), which will generate the surfaces out of the seperated pieces, blit this surface to the screen and then destroy the surface. That wouldn't cost much memory, but it would slow down the speed.

More important then what is best in this case (I don't think I would notice any difference in memory or in speed), is how to decide how to act in those situations. Are there some general routines and rules?
Try writing both ways, and see which way is the best for you. Or try writing the way you prefer first, and if you run into problems revert to the alternative.

FYI: Most blackjack shoes contain 2, 4 or 8 decks. So not just 52 cards.
Thanks for your answer.

I know about the multiple decks, but I'm writing the game with one deck now. I'll add those things later. Thanks for the suggestion.
I already wrote this part of the program when I posted the question. At this moment, the cards are generated when they're blitted to the screen and destroyd right after it. And it works fine.
In this case, I don't think it will make much difference anyway. But I wonder how to decide what's best, for bigger applications where it does make difference. I can imagine programs where thousands of different surfaces are used, and where most of them are build out of other surfaces. What is the best way to handle in this sort of situations?
Topic archived. No new replies allowed.