We produce an algorithm that is optimal with respect to both space and execution time to generate all the lozenge (or domino) tilings of a hole-free, general-shape domain given as input. We first recall some useful results, namely the distributive lattice structure of the space of tilings and Thurston's algorithm for constructing a particular tiling. We then describe our algorithm and study its complexity. Key words: tiling, generation, height function