We present efficient algorithms to decide whether two given counting functions on nonabelian free groups or monoids are at bounded distance from each other and to decide whether two given counting quasimorphisms on nonabelian free groups are cohomologous. We work in the multi-tape Turing machine model with nonconstant-time arithmetic operations. In the case of integer coefficients we construct an algorithm of linear time complexity (assuming that the rank is at least $3$ in the monoid case). In the case of rational coefficients we prove that the time complexity is $O(N\log N)$, where $N$ denotes the size of the input, that is, it is the same as in addition of rational numbers (implemented using the Harvey-van der Hoeven algorithm for integer multiplication). These algorithms are based on our previous work which characterizes bounded counting functions. Bibliography: 20 titles.