Strictly speaking you did not optimize the code, you restructured it. You have performed a refactoring (but probably without tests).
There is a principle of locality inherent in object oriented programming. Meaning, functionality that belongs to an object should be kept at the object. Having a render method in each class is nothing to be condemned per se. There is even a design pattern for it, the command pattern.
In the presented case you collected all render stuff in one extra layer or compartment. The underlying idea is that changes on the object probably make changes of the rendering necessary. So the best case is, object logic and render code are held together. Similar parts could be moved to a common parent class, if this makes things easier to handle.
Don't worry, these are all best practices coming with more experience. Just keep going. Trying to change code and learn something from it is the best teacher you can have!