1 00:00:06,530 --> 00:00:08,440 - Productivity versus performance. 2 00:00:08,440 --> 00:00:10,140 This is a big one. 3 00:00:10,140 --> 00:00:13,677 As an industry, if I asked people, for a long time, 4 00:00:13,677 --> 00:00:15,840 "Is performance your highest priority?" 5 00:00:15,840 --> 00:00:17,210 They would say yes. 6 00:00:17,210 --> 00:00:19,470 But the reality is that productivity 7 00:00:19,470 --> 00:00:20,680 has been our highest priority. 8 00:00:20,680 --> 00:00:22,970 It has been in just the languages we've been designing, 9 00:00:22,970 --> 00:00:24,350 the languages we've been using, 10 00:00:24,350 --> 00:00:26,730 people wanna be productive and get things done, 11 00:00:26,730 --> 00:00:29,390 and we've kind of looked at performance, 12 00:00:29,390 --> 00:00:30,500 it's secondary, though. 13 00:00:30,500 --> 00:00:33,010 If you ask anybody, they're too afraid to tell you that, 14 00:00:33,010 --> 00:00:35,360 because then you don't look like you're technical, 15 00:00:35,360 --> 00:00:36,480 or your chops are in place. 16 00:00:36,480 --> 00:00:38,010 We put people on a pedestal. 17 00:00:38,010 --> 00:00:39,470 We can get on stage and talk about 18 00:00:39,470 --> 00:00:41,350 how they can shave a few milliseconds 19 00:00:41,350 --> 00:00:43,300 or microseconds off of an algorithm, 20 00:00:43,300 --> 00:00:45,610 and I really kinda wanna move away from that. 21 00:00:45,610 --> 00:00:48,980 Productivity really is, and should be, our highest priority, 22 00:00:48,980 --> 00:00:50,910 but we do need performance, 23 00:00:50,910 --> 00:00:52,970 it does matter. 24 00:00:52,970 --> 00:00:56,480 And what I find interesting about our industry, 25 00:00:56,480 --> 00:00:59,350 is that for the last 30 years 26 00:00:59,350 --> 00:01:01,190 we have kind of been on the same path 27 00:01:01,190 --> 00:01:04,290 that Niklaus Wirth has said, back in 1987, 28 00:01:04,290 --> 00:01:07,337 he said that "The hope is that the progress in hardware 29 00:01:07,337 --> 00:01:09,590 "is gonna cure our software ills." 30 00:01:09,590 --> 00:01:11,990 In other words, he's saying that we as software developers 31 00:01:11,990 --> 00:01:13,797 have always said "We don't have to worry 32 00:01:13,797 --> 00:01:15,957 "about performance, the hardware will come in 33 00:01:15,957 --> 00:01:17,230 "and save us." 34 00:01:17,230 --> 00:01:19,870 We've continued to kind of have this mantra 35 00:01:19,870 --> 00:01:21,270 for the last 30 years. 36 00:01:21,270 --> 00:01:24,250 Back in 1987, after I graduated high school, 37 00:01:24,250 --> 00:01:25,760 I was on a plane to Italy 38 00:01:25,760 --> 00:01:27,850 and I sat next to a software developer 39 00:01:27,850 --> 00:01:30,420 and that software developer told me, this is 1987, 40 00:01:30,420 --> 00:01:32,830 all of us, right now, watching this video, 41 00:01:32,830 --> 00:01:34,460 would be Basic developers. 42 00:01:34,460 --> 00:01:36,290 We'd all be coding in Basic today, 43 00:01:36,290 --> 00:01:38,240 because the hardware would be so fast 44 00:01:38,240 --> 00:01:40,300 we wouldn't need anything else. 45 00:01:40,300 --> 00:01:42,370 The reality is that has not happened. 46 00:01:42,370 --> 00:01:44,547 I mean, Henry, back in 2015, wrote, 47 00:01:44,547 --> 00:01:46,067 "The most amazing achievement 48 00:01:46,067 --> 00:01:47,367 "of the computer software industry 49 00:01:47,367 --> 00:01:49,377 "is its continuing cancellation 50 00:01:49,377 --> 00:01:50,697 "of the steady and staggering gains 51 00:01:50,697 --> 00:01:53,260 "made by the computer hardware industry." 52 00:01:53,260 --> 00:01:56,570 We're still talking about this stuff, 30 years ago, 53 00:01:56,570 --> 00:01:58,080 remember I told you before, 54 00:01:58,080 --> 00:02:00,110 the hardware is the platform. 55 00:02:00,110 --> 00:02:01,580 If performance matters, 56 00:02:01,580 --> 00:02:04,410 then we have to be sympathetic with the hardware, 57 00:02:04,410 --> 00:02:06,120 mechanical sympathy. 58 00:02:06,120 --> 00:02:07,260 And look, you know, 59 00:02:07,260 --> 00:02:09,180 the hardware folks really haven't changed hardware 60 00:02:09,180 --> 00:02:10,570 in the last 15 plus years. 61 00:02:10,570 --> 00:02:11,660 They really haven't. 62 00:02:11,660 --> 00:02:13,720 No, we've had these multi-core processors, 63 00:02:13,720 --> 00:02:15,290 multiple hardware threads per core, 64 00:02:15,290 --> 00:02:17,600 and the reason why they're not doing it 65 00:02:17,600 --> 00:02:19,640 is because we haven't been able to take full advantage 66 00:02:19,640 --> 00:02:20,710 of what's there now. 67 00:02:20,710 --> 00:02:22,880 We're starting to see now 68 00:02:22,880 --> 00:02:27,050 Intel talk about their 24, 36 core processors, 69 00:02:27,050 --> 00:02:29,470 and that's great and it sounds amazing, 70 00:02:29,470 --> 00:02:32,070 but if we don't engineer for this hardware, 71 00:02:32,070 --> 00:02:34,480 if we don't understand how it works, 72 00:02:34,480 --> 00:02:36,910 those processors are actually gonna slow us down 73 00:02:36,910 --> 00:02:38,340 not speed us up. 74 00:02:38,340 --> 00:02:39,950 So we're gonna spend some time in this class 75 00:02:39,950 --> 00:02:41,970 talking about how caching works, 76 00:02:41,970 --> 00:02:43,380 and some of the mechanical sympathies 77 00:02:43,380 --> 00:02:46,570 the language drives through us and allows us, 78 00:02:46,570 --> 00:02:49,330 so we can get to these levels of performance that we want. 79 00:02:49,330 --> 00:02:50,610 And hopefully take advantage 80 00:02:50,610 --> 00:02:51,790 of the hardware that's there, 81 00:02:51,790 --> 00:02:53,760 so that the hardware industry stops playing games, 82 00:02:53,760 --> 00:02:54,960 starts giving us more. 83 00:02:54,960 --> 00:02:56,710 But that's on us, it's not on them. 84 00:02:57,640 --> 00:02:59,770 But I think a core part of this class 85 00:02:59,770 --> 00:03:02,550 is gonna be this next quote from Brian Kernighan, 86 00:03:02,550 --> 00:03:05,120 and it starts, him talking about C. 87 00:03:05,120 --> 00:03:08,027 He's asked a question about the C programming language, 88 00:03:08,027 --> 00:03:10,780 but I think you can replace C with Go, 89 00:03:10,780 --> 00:03:13,967 and it absolutely mirrors it exactly. 90 00:03:13,967 --> 00:03:15,867 "Go is the best balance I've seen 91 00:03:15,867 --> 00:03:17,447 "between power and expressiveness. 92 00:03:17,447 --> 00:03:19,287 "You can do almost anything you want to do 93 00:03:19,287 --> 00:03:21,947 "by programming fairly straightforwardly, 94 00:03:21,947 --> 00:03:23,187 "and have a good mental model 95 00:03:23,187 --> 00:03:24,747 "of what's going to happen on the machine, 96 00:03:24,747 --> 00:03:26,707 "and you can predict reasonably well, 97 00:03:26,707 --> 00:03:27,867 "and how quickly it's gonna run, 98 00:03:27,867 --> 00:03:30,010 "and understand what's going on." 99 00:03:30,010 --> 00:03:32,280 This is Go in a nutshell. 100 00:03:32,280 --> 00:03:35,990 I'm going to teach you how to read code in this language, 101 00:03:35,990 --> 00:03:38,320 so that holds true not just for me, 102 00:03:38,320 --> 00:03:39,200 but for you. 103 00:03:39,200 --> 00:03:41,400 And it's possible because Go's model 104 00:03:41,400 --> 00:03:42,970 is not a virtual machine, 105 00:03:42,970 --> 00:03:44,310 it is a real machine. 106 00:03:44,310 --> 00:03:46,050 It is the real machine, 107 00:03:46,050 --> 00:03:48,950 and once you're coding against the real machine 108 00:03:48,950 --> 00:03:51,300 then you can do all of these things 109 00:03:51,300 --> 00:03:54,670 if you just know a little bit about the mechanics 110 00:03:54,670 --> 00:03:57,360 and the semantics of the language. 111 00:03:57,360 --> 00:03:58,210 When I say mechanics, 112 00:03:58,210 --> 00:03:59,680 I'm talking about how things work, 113 00:03:59,680 --> 00:04:00,890 when I say semantics, 114 00:04:00,890 --> 00:04:02,620 I'm talking about how things behave. 115 00:04:02,620 --> 00:04:05,060 And I'm gonna teach you throughout this class 116 00:04:05,060 --> 00:04:06,280 how to be able to do that, 117 00:04:06,280 --> 00:04:08,460 and that's going to drive you 118 00:04:08,460 --> 00:04:11,183 being able to make some better engineering choices.