Understanding the Linear speedup theorem and how strong it is Let $k \in \mathbb{N} $ and define the language $L = \{ n,m | n^k = m \}$

Consider a (deterministic) TM deciding $L$ then it has to compute $k$'th power which will take $f(|n|+|m|) + h(k)$ time in worse case for some polynomials $f,h$. now, by the Linear speedup theorem we can improve this to $\frac{f(|n|+|m|) + h(k)}{h(k)} = O(f(|n|+|m|))$
This means that for whatever $k$ we choose there is a (deterministic) TM deciding it in $O(f(|n|+|m|))$ even for cases $|n+m|&lt;&lt;k$. And this seemingly doesn't make sense, because it leads me to the fact that for every two choises of $k$ there are TM's deciding the corresponding languages in the same running time. What am I missing here?
The linear speedup theorem says that, for any constant&nbsp;$c$, you can decide the language $c$&nbsp;times faster. It does not say that you can make it faster by some non-constant function.

The speedup theorem works by defining a new Turing machine that writes $c$&nbsp;characters of the old Turing machine in a single tape cell, and then adjusting the transition function so that it simulates in a single step everything that the original machine did between entering and leaving each $c$-character block.  If $c$&nbsp;is a constant, it doesn't depend on the input, so you just compute the new machine once and use it on whatever input you want. But if you want $c$ to be some non-constant function, then you have to figure out what the new machine is every time you run it. That takes exponentially long, since there are exponentially many possible $c$-character blocks that you have to figure out the transition function for.