I tried a similar solution (removing / creating walls depending on the distance), the result was not very goodthe - fps increased, but was not stable.