Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sleep! by Alex Koppel

Sleep! by Alex Koppel

Watch the talk here: https://vimeo.com/69311347

Railsberry

April 22, 2013
Tweet

More Decks by Railsberry

Other Decks in Technology

Transcript

  1. Sleep in Rails •Rails 4 on Ruby 2.0 refines Kernel#sleep

    •Accepts negative argument in controllers •Only known use for refinements Saturday, May 25, 13
  2. Sleep in Rails around_filter :deliver_request_fast def deliver_request_fast received_at = Time.now

    yield # go back and deliver the results immediately sleep(received_at - Time.now) end Saturday, May 25, 13
  3. We are thinkers! • Our job is to solve problems

    • Sleep directly impacts the brain • How we sleep affects how we code Saturday, May 25, 13
  4. We have a problem •Huge population suffers from insufficient sleep

    •Estimated 20%+ of Americans affected •Wanting more sleep, not getting it •Frequently tired Source: [10] Saturday, May 25, 13
  5. No no no no We must kill our macho culture

    about sleep Source: [13] Saturday, May 25, 13
  6. No no no no We must kill our macho culture

    about sleep Source: [13] Saturday, May 25, 13
  7. tl;dr •Lack of sleep impairs your thinking •Our natural sleep

    cycles arise from biology •Therefore: we must support sleep Saturday, May 25, 13
  8. 0.hours.sleep • Sleep deprivation hurts your ability to think •

    “This deactivation is greatest in those brain areas sustaining higher cognitive performance and situational awareness.” •Not a surprise Source: [3] Saturday, May 25, 13
  9. Sleep Restriction "Just one more episode, then I'll sleep" or,

    “Time for crunch mode!” Saturday, May 25, 13
  10. Less sleep, less brain • Sleep restriction reduces brain function

    • Cumulative effects over time Saturday, May 25, 13
  11. Less sleep, less brain • Sleep restriction reduces brain function

    • Cumulative effects over time • Proportional to how much sleep lost Saturday, May 25, 13
  12. Science! •Let's quantify this •Common test in sleep research: PVT

    •Measures reaction time, sustained attention •See appendix A Saturday, May 25, 13
  13. Source: [1] Charts and Graphs Y axis: failures to respond

    to visual prompt inside time window X axis: experiment time Saturday, May 25, 13
  14. PVT Results Sleep deprivation (0 hours sleep): errors rise quickly

    1 tick = 2 days Source: [1] Saturday, May 25, 13
  15. 8 hours sleep/night: nearly no change Source: [1] 1 tick

    = 2 days PVT Results Saturday, May 25, 13
  16. Other tests agree •Higher-level tests also show similar effects •Proportional,

    cumulative effects •Impaired learning •See appendix Source: [1] Saturday, May 25, 13
  17. Ok, but... • Can’t you just sleep it off over

    the weekend? Saturday, May 25, 13
  18. Apparently not • The brain adapts to less sleep •This

    persists at least several days after restriction stops • Recovery sleep is physically different Sources: [2], [4], [9] Saturday, May 25, 13
  19. Analysis • Even the 7 hour group wasn’t back to

    original state after 3 nights of full sleep • A weekend isn’t long enough • Obviously you recover eventually Sources: [2], [4], [9] Saturday, May 25, 13
  20. It’s hard! •Even knowing all this, getting to sleep is

    tough •Why are we so bad at staying rested? Saturday, May 25, 13
  21. Sleep disturbed •Many things can affect sleep • Alcohol and

    other drugs • Exercise • Stress and emotion • Diet • Willpower • Kids • Sex • Webcomics Saturday, May 25, 13
  22. Put those aside •Let's just look at natural sleep rhythms

    •Healthy, drug-free people don't get enough sleep either! Saturday, May 25, 13
  23. Chronotypes •A way to group sleepers •The mid-point of our

    natural1 sleep cycles •Regardless of length •For most, 3.5-4 hours into sleep 1 Imagine a quiet 3 week vacation at home, sleeping and waking when you want. Saturday, May 25, 13
  24. In the Population Wakeup time for 7 hours sleep: 8

    AM 10 AM Source: [6] p. 13 Saturday, May 25, 13
  25. Alternately put Source: [6] p. 13 Over 50% of the

    population wakes btw 8 and 11 AM Only ~33% naturally wake up before 8 AM Saturday, May 25, 13
  26. Especially for us Sleep midpoint (hour) Source: [6] p. 101

    Younger populations tend to later sleep Saturday, May 25, 13
  27. •Much of society starts up between 8 and 9 •We're

    asked to live contrary to our biology Yet Saturday, May 25, 13
  28. Social Jet Lag •Society time != body time •Expressed through

    sleep loss •Like traveling by plane every day •40+% of Central Europeans off by 2+ hours Source: [6] p. 149 Saturday, May 25, 13
  29. Aren’t we just lazy? If we want it enough, we

    can wake earlier Saturday, May 25, 13
  30. No •Our bodies sync their clocks with the sun •Most

    people run longer than 24 hours •This “entrainment” tends toward later sleep •Sleep cycles are hard to change Source: [6] p.117-128 Saturday, May 25, 13
  31. To repeat •Sleep cycles arise from biology •(In an otherwise

    constant environment) •We can't (easily) control / change this Saturday, May 25, 13
  32. Managers! •Encourage your team to sleep enough •Let people follow

    their rhythms •Don't worship crunch time Saturday, May 25, 13
  33. Appendix A All the stuff I couldn’t fit in the

    main talk Saturday, May 25, 13
  34. Science is fun •“Some evidence suggests...” •Hard conclusions are hard

    •Explanations, like this, can be preliminary •Moar studies! •But the basics presented here are solid Saturday, May 25, 13
  35. A possible mechanism • Effects of sleep restriction and deprivation

    postulated to share a common trigger [1] • Cumulative excess hours awake • How much longer you’re up in a given period than you should have been • Deprivation effects likely =~ restriction effects (in proportion) • Not the only proposed theory Source: [1] Saturday, May 25, 13
  36. Science time! • Psychomotor vigilance test (PVT) • Subjects respond

    to a visual stimulus • Measures attention and response time •Also lapses (response > 500ms) • Used by NASA and sleep researchers Source: [12] Saturday, May 25, 13
  37. Other Test Results • Sleep restriction impacts shown on other

    tests • Higher-level functions tested than just response time • Tests with learned skills Source: [1] Saturday, May 25, 13
  38. Matching digits to symbols 8 hours: learning bonus 6 hours:

    no learning 4 hours: got worse Source: [1] Digit Symbol Substitution Task Saturday, May 25, 13
  39. Analysis • Sleep restriction effects more manageable with complex tasks

    • BUT no gains from learning • We need to learn to succeed • Interesting question: would gains appear after recovery sleep? Source: [1] Saturday, May 25, 13
  40. Internal Clocks •All humans (organisms) have internal clocks •Few run

    exactly 24 hours per cycle •On average slightly longer Sources: [11], [6] p. 1, 118-127 Saturday, May 25, 13
  41. Light •Our bodies use light to sync with the world

    •Light at different times shifts our sleep/wake cycle •Longer days lead to later sleep patterns Source: [6] p.117-128 Saturday, May 25, 13
  42. Internal Day •We each have an internal "day" •From one

    waking up to the next •Light affects us differently at different times of our days Saturday, May 25, 13
  43. Internal Day When you wake up When you're asleep (hopefully)

    Source: [6] p.121 Saturday, May 25, 13
  44. Internal Day (hopefully) Source: [6] p.121 When you wake up

    When you're asleep Saturday, May 25, 13
  45. Entrainment •Light in the inner morning shortens the day •You

    sleep earlier •Light the in inner evening lengthens it •You sleep later •The body mixes both to get the right adjustment Source: [6] p.117-128 Saturday, May 25, 13
  46. Example •Your day is too long (say, 24.5 hours) •You

    want to compress your day (sleep sooner) •So...what do you do? Saturday, May 25, 13
  47. Solution! •Wake later •Your inner evening happens in the dark!

    •Compression > expansion •A shorter day (24 hours) Saturday, May 25, 13
  48. More proof Waking times among a homogeneous population (Germany) in

    1 time zone are controlled by the sunrise Source: [6] p.158 Saturday, May 25, 13
  49. Bringing it all back home •Most people have a longer

    clock •So most people ought to wake later •And that's what we saw earlier! Saturday, May 25, 13
  50. Ryan North on sleep What's your sleep routine like? When

    I was a kid I had to get up at 6 to catch a 7 AM bus into school, and once I started grad school I relaxed that to 7 AM. So I'm usually up at 7 sharp (alarm set so I can hear the news) and then in bed when I start to get sleepy, which is normally between 11 and midnight. I really value my sleep. And I wish it were somehow super awesome to say "I really value my sleep." [emphasis added] http://lifehacker.com/5986982/im-ryan-north-creator-of-dinosaur-comics-and-this-is-how-i-work Saturday, May 25, 13
  51. Sources 1. Van Dongen, H. P. a, Maislin, G., Mullington,

    J. M., & Dinges, D. F. (2003). The cumulative cost of additional wakefulness: dose-response effects on neurobehavioral functions and sleep physiology from chronic sleep restriction and total sleep deprivation. Sleep, 26(2), 117-26. Retrieved from Source: Van Dongen, etc., UPenn Study, 2003 [1] 2. Belenky, G., Wesensten, N. J., Thorne, D. R., Thomas, M. L., Sing, H. C., Redmond, D. P., Russo, M. B., et al. (2003). Patterns of performance degradation and restoration during sleep restriction and subsequent recovery: a sleep dose-response study. Journal of Sleep Research, 12(1), 1-12. Retrieved from http://www.ncbi.nlm.nih.gov/pubmed/12603781 3. Belenky, G. (1997). Sleep , Sleep Deprivation , and Human Performance in Continuous Operations, 1-13. Retrieved from http://isme.tamu.edu/JSCOPE97/Belenky97/Belenky97.htm 4. Alhola, P., & Polo-Kantola, P. (2007). Sleep deprivation: Impact on cognitive performance. Neuropsychiatric Disease and Treatment, 3(5), 553-567. Dove Medical Press. Retrieved from http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=2849789&tool=pmcentrez&rendertype=abstract 5. Robinson, E. (2005). Why Crunch Mode Doesn’t Work: 6 Lessons. IGDA Retrieved Feb, 1-6. Retrieved from http://www.igda.org/why-crunch-modes-doesnt-work-six-lessons 6. Roenneberg, Till. Internal Time: Chronotypes, Social Jet Lag, and Why You're so Tired. Cambridge, MA: Harvard UP, 2012. Print. 7. Popova, M. (2012). Internal Time : The Science of Chronotypes , Social Jet Lag , and Why You’re So Tired. Retrieved from http://www.brainpickings.org/index.php/2012/05/11/internal- time-till-roenneber/ 8. Roenneberg, T., Daan, S., & Merrow, M. (2003). The Art of Entrainment, 18(3). doi:10.1177/0748730403253393 Saturday, May 25, 13
  52. Sources 2 9. Fackelmann, K. (2007). Study: Sleep deficit may

    be impossible to make up. USA Today. Retrieved from http://www.usatoday.com/news/health/2007-11-25-sleep-deficit_N.htm 10. Hublin C, Kaprio J, Partinen M, Koskenvuo M. (2001) Insufficient sleep: a population-based study in adults. Sleep, 24: 392–400 cited in Wikipedia, replace w other data 11. Toh, K. L., Med, M. I., Uk, M., & Genet, H. (n.d.). Basic Science Review on Circadian Rhythm Biology and Circadian Sleep Disorders, 662-668. 12. Psychomotor vigilance task. (2012, June 11). In Wikipedia, The Free Encyclopedia. Retrieved 10:24, June 22, 2012, from http://en.wikipedia.org/w/index.php? title=Psychomotor_vigilance_task&oldid=497069857 13. Alternative Sleep Cycles: You Don’t Really Need 6-8 Hours! Retrieved April 11, 2013 from http://www.highexistence.com/alternate-sleep-cycles/ Image credits: • welu-berlin. Brandenburger Tor. Retrieved April 21, 2013 from http://www.flickr.com/photos/welu/1345394487/ • Daj12192. Willis Tower. Retrieved April 21, 2013 from http://commons.wikimedia.org/wiki/File:WillisTower11.jpg • Mills, Dan. Hard at Work. Retrieved April 21, 2013 from http://www.flickr.com/photos/thunder/98937190/ • Munroe, Randall. Science. Retrieved April 11, 2013 from http://xkcd.com/54/. • Munroe, Randall. Hallucinations. Retrieved April 21, 2013 from http://xkcd.com/203/ • People in a meadow. Retrieved April 21, 2013 from http://www.yourwealthforlife.com/blog/how-to-enjoy-life-more/ Saturday, May 25, 13