A compilation technique to increase X3D performance and safety