Various methods of desalination (turning salty seawater into drinkable freshwater) have existed for a long time. Thermal desalination is perhaps the simplest method of doing so; heat up the seawater until it evaporates, then condense the pure water on a cool surface. Alternatively, you can do the opposite - freeze the salt water, wait for a while, and then melt it. However, both of these methods have a major problem - it is not cost-efficient to do in significant quantities.
Today, we have several more advanced methods. The most common is reverse osmosis; however, reverse osmosis requires advanced membrane technology that didn't come around until the 1950s and 1960s. The second most common, multi-stage flash distillation, was invented in the late 1950s. MSF is significantly less efficient then RO in several ways (it both requires more energy and has a lower yield), but is still commercially viable.
My question is, given IRL technological pace, what's the earliest point in time when a commercially viable method of desalination could have been invented? Many technologies could have been invented long before they actually were, while others simply could not have. Are there any efficient methods of desalination that fall into the first category, and if so, when could they earliest have plausibly been invented?
I'm asking this question for an alternate history I am writing, if you're wondering why I asked it in the worldbuilding StackExchange. If you think a different StackExchange would be better for answering this question, I'll try asking it there.