I don't think there is a "best time to book". It all depends on your flexibility. If you are totally flexible (e.g. because you are retired), you will probably catch some excellent last-minute deals.
However, the downside is that in that case you must "take what's left", and it will probably not be possible for you to pick a particular cabin.
When booking far in advance, you can choose the cabin of your choice, and - as many ships sail sold out these days - also the ship of your choice. And it might be possible that booking early is less than booking late.