Why computing time increase with backpropagation hooks?

I found the answer myself. Maybe it will help someone.
After creating a hook it should be removed or it will pile up.
See here

So after optimizer.step()
I call h1.remove() where h1 is the returned value of register_hook() function.