What matters is quantity of deep sleep and REM sleep.
REM sleep seems to be related to archiving of events( memory formation ) while lack of deep sleep affects the brain itself.
Pickup a smartwatch and track the sleep stages with Apple watch being the most accurate.