Modern ECT causes temporary confusion and short term memory issues, but my understanding is that they generally clear up after treatment. However, it's a month long treatment, and it's not advised to work or drive during that time. I don't think long term memory loss say several months after treatment is a common problem, but I could be wrong.
To my knowledge TMS doesn't have those memory issues.
Please keep in mind that modern ECT is nothing like what people see in the movies. While I'm not at all saying it should be a first tier treatment, it's a treatment option for those with otherwise treatment resistant depression (and also a few other disorders)
I was personally referred for ECT therapy last summer by my psychiatrist. I was in the middle of a massive depressive episode, had already tried a ton of different medications (and took a break from meds to see if that would help - it didn't), diets, etc. I even mentioned to my doctor I was to the point where I was potentially thinking about self-dosing on psychedelics or ketamine because I felt I had no other options. At that point ECT therapy even with bad side effects (which again to my knowledge don't normally last forever) would be better then suicide.
I didn't go through with it because I'd have to take a month off work, and get transportation to the clinic several times a week. Personally if it gets that bad again I'm going to try to get TMS therapy, as I'm also on the ASD spectrum, and there's been some evidence that suggests it may help those symptoms as well.