Both Dali and Edison did not have families and children to rise. They were multimillionaries also. If you are also childless and multimillionaire, you can experiment with what essentially a sleep deprivation, having hallutinations that are useful in a work of... genius?
Also, in case of Edison, he used an army of assistants to comb through his ideas and patents avaiable at the time to find what is useful. Again, a privilege of multimillionaire
These techniques cannot be used by a person who have to walk a dog early every morning, help his son to go to a school and work with complex code base.