Compact Sobolev embeddings and torsion functions