Aims. Compaction of initially porous material prior to melting is an important process that has influenced the interior structure and the thermal evolution of planetesimals in their early history. On the one hand, compaction decreases the porosity resulting in a reduction of the radius and on the other hand, the loss of porosity results in an increase of the thermal conductivity of the material and thus in a more efficient cooling. Porosity loss by hot pressing is the most efficient process of compaction in planetesimals and can be described by creep flow, which depends on temperature and stress. Hot pressing has been repeatedly modelled using a simplified approach, for which the porosity is gradually reduced in some fixed temperature interval between ≈650 K and 700 K. This approach neglects the dependence of compaction on stress and other factors such as matrix grain size and creep activation energy. In the present study, we compare this parametrised method with a self-consistent calculation of porosity loss via a creep related approach. Methods. We use our thermal evolution model from previous studies to model compaction of an initially porous body and consider four basic packings of spherical dust grains (simple cubic, orthorhombic, rhombohedral, and body-centred cubic). Depending on the grain packing, we calculate the effective stress and the associated porosity change via the thermally activated creep flow. For comparison, compaction is also modelled by simply reducing the initial porosity linearly to zero between 650 K and 700 K. As we are interested in thermal metamorphism and not melting, we only consider bodies that experience a maximum temperature below the solidus temperature of the metal phase. Results. For the creep related approach, the temperature interval in which compaction takes place depends strongly on the size of the planetesimal and is not fixed as assumed in the parametrised approach. Depending on the radius, the initial grain size, the activation energy, and the initial porosity and specific packing of the dust grains, the temperature interval lies within 500−1000 K. This finding implies that the parametrised approach strongly overestimates compaction and underestimates the maximum temperature. For the cases considered, the post-compaction porous layer retained at the surface is a factor of 1.5 to 4 thicker for the creep related approach. The difference in the temperature evolution between the two approaches increases with decreasing radius and the maximum temperature can deviate by over 30% for small bodies.