{"id":22046,"date":"2014-01-21T20:08:27","date_gmt":"2014-01-22T01:08:27","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=22046"},"modified":"2014-01-21T20:54:14","modified_gmt":"2014-01-22T01:54:14","slug":"experienced-points-with-great-power","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=22046","title":{"rendered":"Experienced Points: With Great Power&#8230;"},"content":{"rendered":"<p>So the next-gen consoles are out. Let&#8217;s talk about <a href=\"http:\/\/www.escapistmagazine.com\/articles\/view\/columns\/experienced-points\/10919-With-Great-Power\">what we can do with all of that processing power<\/a> without going broke making hyper-realistic graphics.<\/p>\n<p>So that&#8217;s the article. Now let&#8217;s go on a tangent. At one point in the article I said&#8230;<\/p>\n<blockquote><p>If you&#8217;ve got even a mid-range computer with a decent graphics card, then your computer has more processing power than every computer that existed before the year I was born. (1971) That&#8217;s including the supercomputers built by world governments and all the computers involved in sending humans to the moon.<\/p><\/blockquote>\n<p>How I arrived at this conclusion:<\/p>\n<p><!--more-->There&#8217;s <a href=\"http:\/\/en.wikipedia.org\/wiki\/Moore's_law\">Moore&#8217;s Law<\/a>, which colloquially is that &#8220;computers get twice as fast every two years&#8221;. That&#8217;s not exactly what the man said, but it&#8217;s close enough for most discussions and is a good rule of thumb when measuring performance. He was actually talking about transistor densities, and while more transistors = more power, the relationship is not 1:1 and there&#8217;s plenty of room for haggling over what &#8220;performance&#8221; means.<\/p>\n<p>In any case: It&#8217;s been 42 years since I was born, which means things have &#8220;doubled&#8221; 21 times. 2<sup>21<\/sup> is 2,097,152 which means that your computer is supposedly that many times faster than a 1970 computer. Were there 2 million new computers built in 1970? I don&#8217;t think so. These were the days of &#8220;big iron&#8221;, when computers cost millions of dollars and were only owned by large entities. Sales were probably in the thousands or tens of thousands. <\/p>\n<p>We can add in all the computers before that point, but we have to keep in mind that as we go backwards computers continue to get slower. So a computer from 1967 would only count as &frac14; of a &#8220;1971 computer&#8221;, a 1965 computer would count as <sup>1<\/sup>\/<sub>8<\/sub> and a 1959 computer would only be <sup>1<\/sup>\/<sub>64<\/sub>. Adding the computers this way, I think my original (admittedly hyperbolic) claim is true enough: The average desktop computer, if magically transported back to 1971, would be the envy of world governments and would be able to out-perform all the others combined.<\/p>\n<p>I tried to work out just how much more &#8220;powerful&#8221; that computer would be, but there are so many incomparables. Sure, clock speeds have gone up by 2,097,152, but that&#8217;s not the whole story. We also have <a href=\"http:\/\/en.wikipedia.org\/wiki\/CPU_cache\">L1 and L2 cache<\/a>. Memory isn&#8217;t just faster, it&#8217;s also larger, increasing how much stuff you can work on before you are obliged to go to the hard drive. Hard drives are orders of magnitude faster, plus they usually have some level of cache of their own. What about the RIDICULOUS processing power of your graphics card? That&#8217;s a whole bunch of extra processors that aren&#8217;t even included in that 2,097,152 figure.<\/p>\n<p>So the question of &#8220;how much faster is it&#8221; kind of depends on what you&#8217;re trying to do. If you&#8217;re doing something completely linear like looking for primes or calculating pi, then your computer will go roughly 2,097,152 times faster. But what if we&#8217;re doing something that requires a bunch of memory? What if we&#8217;re looking for patterns or repetition in pi? Once the number of digits goes above the memory limit of your typical 1970 computer the speed differential is going to skyrocket as the old computers have to write and read from disk. You could even say it will skyrocket yet again when we hit the limits of the hard drives of the day, since then you&#8217;d need to have a bunch of interns running around swapping reels of magnetic tape or whatever. <\/p>\n<p>But even this comparison ignores the GPU power. What would the speed difference be if, instead of calculating pi, we were trying to run Borderlands at 1600&#215;900? We&#8217;d have to hand-wave the fact that it&#8217;s physically impossible to run the game on those old machines. We could abstract it out and say &#8220;how long would it take a 1970 computer to render the typical Borderlands frame?&#8221;, which is a bit more comprehensible and lets us ignore stuff like OS, drivers, input devices, etc. Now the problem is simply a matter of reading in a fixed number of polygons from disk, processing them, and saving the resulting image out to disk again. (No point in trying to display the image on the monitors of the day. They don&#8217;t have the resolution or color depth.) <\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/borderlands2_1.jpg' class='insetimage' width='600' alt='This seems like a good thing to produce with millions of dollars of specialized computer equipment.' title='This seems like a good thing to produce with millions of dollars of specialized computer equipment.'\/><\/td><\/tr><\/table><\/p>\n<p>Going back to our 1:2,097,152 speed differential: If it takes us <sup>1<\/sup>\/<sub>30<\/sub> of a second to render a frame of Borderlands then it will take the scientists of the past in the ballpark of 20 hours of raw processing to make it happen. <\/p>\n<p><em>But wait! It&#8217;s worse!<\/em><\/p>\n<p>That&#8217;s assuming it&#8217;s just one modern processor vs. a single 1970 processor, which VERY much not the case. One modern processor is 2 million times faster than one from 1970, but your graphics card has, what? Dozens of cores? It depends, and I don&#8217;t know enough about the core counts in modern cards and how those counts have changed over time. In any case the graphics card is technically a whole pile of computers that have been perfectly optimized for this specific task.<\/p>\n<p>Perusing Wikipedia, it looks like if I treat your typical GPU like 15 regular processors I can run these numbers without being accused of unfairly stacking the deck against the machines of the past. So we&#8217;ll think of your computer as 16 CPUs, your GPU+CPU. So your computer isn&#8217;t 2 million times faster at this task. It&#8217;s 33,554,432 times faster. The processing won&#8217;t take the old computer 20 hours, it will take 13 days.<\/p>\n<p><em>But wait! It&#8217;s worse!<\/em><\/p>\n<p>The &#8220;20 hours \/ 13 days&#8221; figure is only true if they have unlimited memory, which old timers will be happy to tell you was never the case.  For the purposes of this comparison, let&#8217;s give the people of the past a break and let them use the processor and memory from the 1975 <a href=\"http:\/\/en.wikipedia.org\/wiki\/Altair_8800\">Altair 8800<\/a>, with whatever industrial-grade hard drives were available at the time, if only because that makes things easier on me. We&#8217;ll assume they&#8217;re saddled with the throughput and seek times of the day, but their hard drives can be as big as they need to be so we don&#8217;t have to run the legs off our interns hauling truckloads of tape drives around.<\/p>\n<p>The high-end Altair had 8k of memory. Your average texture map in Borderlands is probably 512<sup>2<\/sup> pixels, with each pixel requiring 4 bytes of memory. So when it comes time to render (say) <a href=\"http:\/\/borderlands.wikia.com\/wiki\/Brick\">Brick<\/a>&#8216;s face we need to get 1,048,576 bytes of data into our 8,192 bytes of main memory. That&#8217;s obviously not going to fit. What we&#8217;d have to do is <del datetime=\"2014-01-21T22:38:37+00:00\">give up<\/del> painstakingly read in the first 8,192 bytes of the texture, render as many pixels as we could with it, then completely purge main memory and read the next 8,192 bytes from disk. Repeat that 128 times. Awesome. That&#8217;s one polygon. <\/p>\n<p>(We&#8217;re ignoring <a href=\"http:\/\/en.wikipedia.org\/wiki\/Mip_map\">mip maps<\/a> and antialiasing, which would make this task much harder. We&#8217;re also ignoring the fact that we&#8217;d have less than 8k to work with, because the rendering program itself would eat it all up.) <\/p>\n<p><em>But wait! It&#8217;s worse!<\/em><\/p>\n<p>Where are we storing the final image? It&#8217;s 4,320,000 bytes, which is five hundred times larger than our main memory, which is already filled with input data anyway. Ignoring this (or spotting the old computer another 8k of memory just to be sporting) I suppose we&#8217;d have to read in the final image one block at a time, draw the polygons that touch that section of the image, then save it back to disk and load in the next block. <\/p>\n<p>In this scenario, it hardly matters what the processor speeds are. Yes, it will take excruciatingly long for the old computer to transform and light those polygons, and longer still for it to calculate those color values. But that processing is a really trivial part of this project. Since we&#8217;re doing the final image a single 8k block at a time, the whole thing <del datetime=\"2014-01-21T22:38:37+00:00\">is stupid and impossible<\/del> would need to be rendered about five hundred times. We&#8217;d load in a block of image, process everything, save that block out to disk, then load in the next block and repeat. And keep in mind that each round of processing requires us to process each polygon by drawing it a little bit at a time and then swapping in the next block of texture data. The 13 days of processing would need to be repeated hundreds of times. <\/p>\n<p>We could eliminate bits of the &#8220;repeated hundreds of times&#8221; figure by throwing away polygons when they fall outside the current block we&#8217;re rendering, but it hardly matters. The processing is nothing compared to all that disk I\/O. It&#8217;s hard to find data on how fast (or rather, how SLOW) drives were in 1970. Even <a href=\"http:\/\/www.tomshardware.com\/reviews\/15-years-of-hard-drive-history,1368-7.html\">this drive from 1991<\/a> looks <a href=\"http:\/\/www.tomshardware.com\/reviews\/15-years-of-hard-drive-history,1368-2.html\">pretty grim<\/a>. The closest I could come is <a href=\"http:\/\/tylermuth.wordpress.com\/2011\/11\/02\/a-little-hard-drive-history-and-the-big-data-problem\/\">this chart<\/a>, which only goes back to 1979 and suggests that a 1979 drive could move about half a megabyte a second, with a seek time (according to <a href=\"http:\/\/en.wikipedia.org\/wiki\/Hard_disk_drive_performance_characteristics\">this Wikipedia article<\/a>) of 100ms or so. <\/p>\n<p>Every single read from disk is going to take ~115 milliseconds even with that 1979 drive, and we need to read 128 times. Which means we&#8217;re spending fifteen full seconds per polygon <em>just on disk I\/O<\/em>.  Plus the time it takes to do the calculations. Multiplied by the number of polygons in the scene. Multiplied by the number of passes it takes to render it in 8k blocks. Oh, and the polygons themselves don&#8217;t fit in memory either, so we&#8217;ll need to read those in and out of memory as well.<\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/borderlands2_2.jpg' class='insetimage' width='600' alt='Was it worth the wait?' title='Was it worth the wait?'\/><\/td><\/tr><\/table><\/p>\n<p>My calculator says the job would take just over 16 years. Computers would double in power eight times while the job was running. If they began the job in 1970, then sometime in March of 1986 the scientists could put down their Rubik&#8217;s Cubes and check out the completed image. I suppose they&#8217;d have to print it out, since computer displays still wouldn&#8217;t be advanced enough to display it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So the next-gen consoles are out. Let&#8217;s talk about what we can do with all of that processing power without going broke making hyper-realistic graphics. So that&#8217;s the article. Now let&#8217;s go on a tangent. At one point in the article I said&#8230; If you&#8217;ve got even a mid-range computer with a decent graphics card, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[102],"tags":[],"class_list":["post-22046","post","type-post","status-publish","format-standard","hentry","category-weekly-column"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/22046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22046"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/22046\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}