You need to see the whole context to understand this ironically sarcastic remark by Hamlet.
But what is your affair in Elsinore?
We'll teach you to drink deep ere you depart.
My lord, I came to see your father's funeral.
I pray thee, do not mock me, fellow-student;
I think it was to see my mother's wedding.
Indeed, my lord, it follow'd hard upon.
Thrift, thrift, Horatio! the funeral baked meats
Did coldly furnish forth the marriage tables.
Would I had met my dearest foe in heaven
Or ever I had seen that day, Horatio!
This quotation is another instance in which Shakespeare uses wit, in this case, sarcastic wit, to make a point. One of Shakespeare's favorite devices is to approach a statement from a negative position, in other words from an opposite or antithetical position. In doing this, Shakespeare says what something is not to get at what it is, sometimes letting you infer what it is.
Not only is Hamlet commenting on the swiftness of his mother's marriage to his uncle but he is also providing a sarcastic reason for the swiftness. He is sarcastically and ironically describing their marriage as occurring so quickly after his father's funeral that the meats served as hot dishes after the burial of Old Hamlet were still fresh enough to be served as cold cuts at Gertrude's and Claudius's wedding.
He is also sarcastically and ironically offering Horatio an explanation for why the wedding was so rushed and he is revealing his great disgust with his mother at her impatience to marry. He offers the explanation--that is no real explanation--that their reason for so unseemly a haste was a wish to be economical. American Heritage Dictionary defines thrift as "wise economy in the management of money and other resources." Hamlet's great sarcasm and disdain is apparent because the King and Queen have no need to be economical in their celebrations of religious rites.
Hamlet immediately afterward lets his true feelings be known to his true friend Horatio when he says that he had rather share Heaven with the worst of his enemies (more sarcasm) than see his mother show so little love, devotion and grief for her dead husband and King, Hamlet's father.