There's nothing in Moodle that requires access to the (public) internet. An entirely internal installation of Moodle should be the same speed as one installed in the "cloud" - all else being equal.
The first things to check when Moodle is slow is to run the performance report and then to check that caching is properly configured. Don't try to cache on relatively slow NFS storage (for example)