We investigate the function $L(h, p, q)$, called here the threshold function, related to periodicity of partial words (words with holes). The value $L(h, p, q)$ is defined as the minimum length threshold which guarantees that a natural extension of the periodicity lemma is valid for partial words with $h$ holes and (strong) periods $p$, $q$. We show how to evaluate the threshold function in $O(\log p + \log q)$ time, which is an improvement upon the best previously known $O(p+q)$-time algorithm. In a series of papers, the formulae for the threshold function, in terms of $p$ and $q$, were provided for each fixed $h\le 7$. We demystify the generic structure of such formulae, and for each value h we express the threshold function in terms of a piecewise-linear function with $O(h)$ pieces.