TL;DR: If you are as stubborn as I was in considering melatonin or more generally sleep aids, I would reconsider. My quality of life has gone up dramatically.
Throughout my life so far, I've been pretty stubborn about "I don't want to see a doctor". A lot of it formed out of edgy high school beliefs of (1) if I can't survive it on my own, I don't deserve to survive it, and (2) not everyone has access to a doctor, isn't it unfair if I do? This attitude generally extended to medication and supplements. I drink coffee, but apart from that, it used to take a huge amount of convincing to take something as dumb as a paracetamol (tylenol in freedom land).
I have since mellowed down a lot from high school days, though I'm still uncomfortable with the idea of "a pill for every problem" -- Reddit stories abound about adderall abuse. Before starting undergrad, I promised myself that I would get through undergrad with the same no-dependence attitude from high school. In retrospect, this was probably a mistake and my learning has suffered for it.
My sleep quality started going downhill in Singapore. After two years of sub-par to average grades, I was determined to do well academically at the expense of sleep. I would pull all-nighters, shave an hour from both ends of sleep time, started experiencing microsleeps while lined up for morning assembly, etc. In general, I learned how to force myself to stay awake regardless of however tired I was feeling. It was also around this time that I would start experiencing brain fog, a general sense of tiredness and some dull aching pains when I woke up.
In college, my sleep problems evolved into setting various alarms at 1am, 3am, etc., if I had to rush homework for a class or prepare for TAing later. The brain fog got significantly worse, and it showed most readily in my variance when it came to CS theory -- on a good day, most things were obvious and my grades were fine, and on a bad day, I struggled significantly to remember the basics and my grades tanked. I also had trouble recalling material from previous courses; heck, it generally took active effort to remember interactions with people.
The net effect was that my sleep schedule and memory were both abysmal. I found ways to compensate for this academically, primarily centered around developing methods for re-teaching myself material in less than a day. This typically involved handwritten summary sheets and significant reliance on refining my intuition. It didn't help a lot for math and algorithms where you needed to bank on exercises and experience, but it worked pretty well in systems. It also worked out as a TA. A significant amount of 150 material were concepts that I kept forgetting and having to relearn every office hours, lab, and grading session. Perhaps this was why people seemed to find my office hours useful? The overall situation was untenable.
But now that I'm no longer an undergraduate and my promise is over, I tried listening to the Reddit/HN advice of melatonin and vitamin D. I bought these two months ago from Costco at a relatively affordable price (less than a meal out). I take vitamin D at lunch and melatonin half an hour before I go to bed.
The difference is amazing.
The first night, I realized how much random dull aching in my limbs just disappeared. I don't think I even noticed some of the ache before. My mind felt a lot clearer. I could get out of bed immediately.
I don't need to regularly take melatonin or vitamin D either. I only take melatonin now if it reaches 2am and I cannot sleep, which is relatively rare nowadays, and I take vitamin D if I didn't go outside at all for the day (since COVID is a thing right now).
There are two caveats with this anecdote. Firstly, this is confounded with me graduating, so I don't have anywhere near as much work to do now (still working though). I will probably post an update when I'm back to taking courses as a graduate student. Secondly, I find that the melatonin only works if I switch off the light. It is ok to continue using electronics and to continue doing work, but the light has to be off for the sleepiness-on-demand to work.
But yeah. As far as my recent months of personal experience have showed, I was definitely in the wrong here back in high school. The melatonin and vitamin D combo is affordable, has no discernible side-effects as of now, does not seem to induce dependency, and has dramatically increased my quality of life. Everyone works a little differently, but if you're similarly on the fence and have faced similar problems (nonexistent sleep schedule, memory fog, dull aching limbs), it may be worth trying out.
I wonder how much easier life would have been without making that promise to myself. Do people normally operate like this? Wild.