Slide 1

Slide 1 text

Sleep! Alex Koppel - @arsduo Saturday, May 25, 13

Slide 2

Slide 2 text

Me Saturday, May 25, 13

Slide 3

Slide 3 text

Me Saturday, May 25, 13

Slide 4

Slide 4 text

Me Saturday, May 25, 13

Slide 5

Slide 5 text

Me Saturday, May 25, 13

Slide 6

Slide 6 text

Me Saturday, May 25, 13

Slide 7

Slide 7 text

Sleep on Rails Saturday, May 25, 13

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Time Travel is Webscale Saturday, May 25, 13

Slide 11

Slide 11 text

Real Sleep Saturday, May 25, 13

Slide 12

Slide 12 text

Why? Saturday, May 25, 13

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

We have a problem Saturday, May 25, 13

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

tl;dr •Lack of sleep impairs your thinking •Our natural sleep cycles arise from biology •Therefore: we must support sleep Saturday, May 25, 13

Slide 19

Slide 19 text

Science ahoy! Saturday, May 25, 13

Slide 20

Slide 20 text

Sleep is complicated Saturday, May 25, 13

Slide 21

Slide 21 text

Less Sleep, No Sleep and what happens to you Saturday, May 25, 13

Slide 22

Slide 22 text

Baseline • Most people need 7-8.5 hours of sleep Source: [4], [6] Saturday, May 25, 13

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

Sleep Restriction "Just one more episode, then I'll sleep" or, “Time for crunch mode!” Saturday, May 25, 13

Slide 25

Slide 25 text

def chronic_sleep_restriction •Getting reduced sleep over repeated nights •Estimated 20%+ of Americans affected Source: [10] Saturday, May 25, 13

Slide 26

Slide 26 text

Effects • Sleep restriction reduces brain function Saturday, May 25, 13

Slide 27

Slide 27 text

Effects • Sleep restriction reduces brain function Surprise! Saturday, May 25, 13

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Less sleep, less brain • Sleep restriction reduces brain function • Cumulative effects over time • Proportional to how much sleep lost Saturday, May 25, 13

Slide 30

Slide 30 text

Science! •Let's quantify this •Common test in sleep research: PVT •Measures reaction time, sustained attention •See appendix A Saturday, May 25, 13

Slide 31

Slide 31 text

Source: [1] Charts and Graphs Y axis: failures to respond to visual prompt inside time window X axis: experiment time Saturday, May 25, 13

Slide 32

Slide 32 text

PVT Results Sleep deprivation (0 hours sleep): errors rise quickly 1 tick = 2 days Source: [1] Saturday, May 25, 13

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

4 hours sleep/night: sleep-deprived in a week Source: [1] PVT Results Saturday, May 25, 13

Slide 35

Slide 35 text

6 hours sleep/night: sunk by week 2 Source: [1] PVT Results Saturday, May 25, 13

Slide 36

Slide 36 text

PVT Recap <= 6 hours sleep: Bad shit happens. Source: [1] Saturday, May 25, 13

Slide 37

Slide 37 text

Other tests agree •Higher-level tests also show similar effects •Proportional, cumulative effects •Impaired learning •See appendix Source: [1] Saturday, May 25, 13

Slide 38

Slide 38 text

Ok, but... • Can’t you just sleep it off over the weekend? Saturday, May 25, 13

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

Another study Source: [2] Saturday, May 25, 13

Slide 41

Slide 41 text

Incomplete recovery Source: [2] Lowest baseline value Saturday, May 25, 13

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

It’s hard! •Even knowing all this, getting to sleep is tough •Why are we so bad at staying rested? Saturday, May 25, 13

Slide 44

Slide 44 text

Sleep disturbed •Many things can affect sleep • Alcohol and other drugs • Exercise • Stress and emotion • Diet • Willpower • Kids • Sex • Webcomics Saturday, May 25, 13

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

Chronotypes Our sleep patterns Saturday, May 25, 13

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

In the Population Wakeup time for 7 hours sleep: 8 AM 10 AM Source: [6] p. 13 Saturday, May 25, 13

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

Especially for us Sleep midpoint (hour) Source: [6] p. 101 Younger populations tend to later sleep Saturday, May 25, 13

Slide 51

Slide 51 text

•Much of society starts up between 8 and 9 •We're asked to live contrary to our biology Yet Saturday, May 25, 13

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

Objection! Saturday, May 25, 13

Slide 54

Slide 54 text

Aren’t we just lazy? If we want it enough, we can wake earlier Saturday, May 25, 13

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

Conclusion Wake up, it's almost over Saturday, May 25, 13

Slide 57

Slide 57 text

To repeat •Sleep cycles arise from biology •(In an otherwise constant environment) •We can't (easily) control / change this Saturday, May 25, 13

Slide 58

Slide 58 text

And •Getting less sleep damages thinking •Damaging thinking is damaging coding Source: [6] p.112 Saturday, May 25, 13

Slide 59

Slide 59 text

Saturday, May 25, 13

Slide 60

Slide 60 text

•Respect your own biology •Get enough sleep! •It's difficult, but worth it Saturday, May 25, 13

Slide 61

Slide 61 text

Managers! •Encourage your team to sleep enough •Let people follow their rhythms •Don't worship crunch time Saturday, May 25, 13

Slide 62

Slide 62 text

Sleep has real benefits •Health •Memory •Reducing stress •Etc. Saturday, May 25, 13

Slide 63

Slide 63 text

Saturday, May 25, 13

Slide 64

Slide 64 text

http://www.amazon.com/Internal-Time-Chronotypes-Social-Youre/dp/0674065859 Highly recommended Saturday, May 25, 13

Slide 65

Slide 65 text

Thanks! Alex Koppel - @arsduo Saturday, May 25, 13

Slide 66

Slide 66 text

We're hiring! Saturday, May 25, 13

Slide 67

Slide 67 text

Thanks! Alex Koppel - @arsduo Saturday, May 25, 13

Slide 68

Slide 68 text

Appendix A All the stuff I couldn’t fit in the main talk Saturday, May 25, 13

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

Sleep Deprivation Saturday, May 25, 13

Slide 71

Slide 71 text

Just how bad? ~66% performance loss after 3 days Source: [3] Saturday, May 25, 13

Slide 72

Slide 72 text

Sleep Restriction Saturday, May 25, 13

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

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

Slide 77

Slide 77 text

Similar results Source: [1] Sustained Addition and Subtraction Task Saturday, May 25, 13

Slide 78

Slide 78 text

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

Slide 79

Slide 79 text

Body Clocks The Art of Entrainment Saturday, May 25, 13

Slide 80

Slide 80 text

Here’s where it gets complicated (and interesting) Saturday, May 25, 13

Slide 81

Slide 81 text

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

Slide 82

Slide 82 text

But if our clocks aren't 24 hours... Saturday, May 25, 13

Slide 83

Slide 83 text

Won’t craziness ensue? When you wake up Saturday, May 25, 13

Slide 84

Slide 84 text

Half Saturday, May 25, 13

Slide 85

Slide 85 text

and half Saturday, May 25, 13

Slide 86

Slide 86 text

Saturday, May 25, 13

Slide 87

Slide 87 text

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

Slide 88

Slide 88 text

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

Slide 89

Slide 89 text

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

Slide 90

Slide 90 text

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

Slide 91

Slide 91 text

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

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

Solution! •Wake later •Your inner evening happens in the dark! •Compression > expansion •A shorter day (24 hours) Saturday, May 25, 13

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

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

Slide 96

Slide 96 text

Appendix B A few webcomics Saturday, May 25, 13

Slide 97

Slide 97 text

http://www.qwantz.com/index.php?comic=136 Saturday, May 25, 13

Slide 98

Slide 98 text

http://www.qwantz.com/index.php?comic=1191 Saturday, May 25, 13

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

http://xkcd.com/320/ Saturday, May 25, 13

Slide 101

Slide 101 text

http://xkcd.com/448/ Saturday, May 25, 13

Slide 102

Slide 102 text

http://www.phdcomics.com/comics/archive.php?comicid=1079 Saturday, May 25, 13

Slide 103

Slide 103 text

Sources Saturday, May 25, 13

Slide 104

Slide 104 text

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

Slide 105

Slide 105 text

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