Script to optimize a terrain map faster

Hello everyone, I am doing commission and my map use over 400 MB and I know there is a script to optimize the map faster.
It would be appreaciated if you could share one or I can buy it if needed.

This script would remove all extra terrain that we can’t see while on the map.
Thank you and I hope you can help me!