CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"
-
Not SyncedSo hi there, everyone.
-
Not SyncedMy name is Chandler Carruth.
-
Not SyncedI work for Google
-
Not SyncedI work on our C++ language platform
-
Not SyncedI work on our C++ compilers
-
Not Syncedspecifically the Clang and LLVM teams at Google
-
Not SyncedAnd I'm here to talk to you a little about performance.
-
Not Syncedand efficiency, and making code fast,
-
Not Syncedand all the different things that go into that.
-
Not SyncedBut before I do too much
-
Not SyncedI want to give actually give you guys a little bit of
-
Not Syncedone might say are expectations.
-
Not SyncedBecause I have been reading the twitter feed
-
Not Syncedfrom all these folks, that talk about
-
Not Syncedall these crazy good questions
-
Not SyncedI just want you guys to essentially know
-
Not Syncedthis is my view
-
Not Syncedof what Performance 101 should be.
-
Not SyncedOkay? This is going to be kind of an intro talk.
-
Not SyncedYou guys are hard core, really deep performance nuts.
-
Not SyncedYou may be a little bit bored, and please be kind,
-
Not Syncedbecause I'm going to gloss over some things
-
Not Syncedyou could heckle me thoroughly if you really want to
-
Not SyncedWe're going to talk about efficiency, performance,
-
Not Syncedalgorithms and data structures.
-
Not SyncedAnd the first thing we are going to do is we're not going to talk about them.
-
Not SyncedWe're going to talk about why anyone cares about them.
-
Not SyncedHow many folks here think it's really important
-
Not Syncedto have high performance in C++?
-
Not SyncedRaise your hand if think that it's super important.
-
Not SyncedEveryone thinks it's important!
-
Not SyncedAnd the folks here who have a really clear idea why performance is important.
-
Not SyncedNow, all the people who didn't raise their hands the second time,
-
Not SyncedPlease reconsider raising your hand the first time.
-
Not SyncedWe actually need to understand why performance is important in C++,
-
Not Syncedbefore we actually decide it's important, we're going to care a lot about it.
-
Not SyncedI'm going to tell you why I care about performance in C++.
-
Not SyncedMost of it comes down to a quote from Nicolas Werth.
-
Not SyncedWhich I will try to pronounce correctly but fail miserably.
-
Not SyncedI actually really like a lot of our stuff,
-
Not SyncedI think he encapsulates a lot of my thoughts,
-
Not Syncedwhat's core to my philosophy here.
-
Not SyncedThe software is getting slower more rapidly than
-
Not Syncedhardware becomes faster.
-
Not SyncedThis is particularly in contrast to
-
Not Syncedthe kind of normal Moore's Law approach:
-
Not SyncedHardware's getting faster, all the time
-
Not Syncedit's okay, we don't need to make software faster,
-
Not Syncedbecause the hardware will catch up.
-
Not SyncedAnd it turns out that's not really true.
-
Not SyncedWe're really good at writing slow software.
-
Not SyncedEven in C++, we're really good at writing slow software.
-
Not SyncedIt's hard to write fast software,
-
Not Syncedand it takes a lot of effort.
-
Not SyncedAnd so it's important to think about
-
Not Syncedwhy that might matter no matter how fast
-
Not Syncedthe processors get.
-
Not SyncedAnd to give you an idea of just how much
-
Not SyncedI think Nicholas Werth is on the same page
-
Not SyncedI just have to mention he actually wrote a book
-
Not Syncedentitled Algorithms + Data Structures = Programs.
-
Not SyncedI did not realize this as I was picking
-
Not Syncedthe title of the topic.
-
Not SyncedAnyways, we're going to come back
-
Not Syncedto the title of this book.
-
Not SyncedBecause he predicted some whole elements
-
Not Syncedof this talk in this book.
-
Not SyncedSo how many folks here have read this book?
-
Not SyncedAnyone? All right! A long time ago.
-
Not SyncedIt's a good book. It's a good book.
-
Not SyncedOkay, so I actually think the idea that
-
Not Syncedsoftware is getting slower too quickly, right?
-
Not Syncedis really getting slower at an astonishing
-
Not Syncedrate is even more important than before.
-
Not SyncedAnd for pretty specific reasons.
-
Not SyncedThere was a very seminal event that
-
Not Syncedhappened in the technology world some time ago
-
Not Syncedthat changed, in my opinion and a lot of
-
Not Syncedother peoples' opinion, how we look at
-
Not Syncedcomputing devices, the performance of
-
Not Syncedcomputing devices, the challenges we face
-
Not Syncedrunning software for computing devices.
-
Not SyncedAnd this event was the iPhone. Okay?
-
Not SyncedAnd when Steve Jobs introduced the iPhone,
-
Not Syncedhe was not doing anything particular to C++
-
Not Syncedbut he was changing how we
-
Not Syncedthink about computing.
-
Not SyncedMobile was now a first class compute citizen.
-
Not SyncedIt took the world a little while to even
-
Not Syncedrealize that that was what had happened that day.
-
Not SyncedBut that's what happened.
-
Not SyncedWe now have to care about mobile.
-
Not SyncedWe have to care about things that are small.
-
Not SyncedRight? things that are hard and challenging
-
Not Syncedto fit big bulky systems into.
-
Not SyncedAnd we essentially get into this annoying
-
Not Syncedsituation of, we have small, we have fast
-
Not Syncedmachines. We have to choose one.
-
Not SyncedWe don't get to choose though.
-
Not SyncedWe're going to choose small almost every time.
-
Not SyncedBut it gets worse.
-
Not SyncedBecause the other problem that the iPhone
-
Not Syncedintroduced that people weren't
-
Not Syncedreally focused on at the time
-
Not Syncedwas the problem of a battery.
-
Not SyncedWhat do we do about the battery in your phone?
-
Not SyncedYou phone's battery, I mean my phone's
-
Not Syncedbattery is about dead. Right?
-
Not SyncedHow many folks here have charged their
-
Not Syncedphone today? (Laughter from audience) Okay?
-
Not SyncedThat's a problem. That's not a feature.
-
Not SyncedThat's a bug. (Laughter from audience) Okay?
-
Not SyncedYes, How many folks are charging their phone now?
-
Not Synced(Laughter from audience) Okay so we kind of
-
Not Syncedentered this new problem domain, suddenly
-
Not Syncedpower became relevant.
-
Not SyncedThere's some kind of shady research I want
-
Not Syncedto push back against.
-
Not SyncedThere's some research into power efficient
-
Not Syncedinstructions. If you ever read about power
-
Not Syncedefficient instructions or optimizing
-
Not Syncedpower usage, you should become very suspicious.
-
Not SyncedAnd you should probably run the other direction.
-
Not SyncedBecause this is mostly total junk science. Okay?
-
Not SyncedHere's the number one leading theory
-
Not Syncedabout how to save this, how to save
-
Not Syncedbattery life. Finish running the program.
-
Not Synced(Audience laughter) Seriously, race to sleep.
-
Not SyncedThat's the actual technical term, race to sleep.
-
Not SyncedThe faster your software runs, the less
-
Not Syncedpower it consumes. Now people get really
-
Not Syncedupset about this. No, no if I run
-
Not Syncedsoftware really fast, then it heats up my
-
Not Syncedprocessor, all that excess heat, that's the
-
Not Syncedwasted power. But it's not, okay? Here's
-
Not Syncedthe thing, we've never really figured out
-
Not Syncedhow to run processors and do work
-
Not Syncedon processors in a
-
Not Syncedpower efficient way. Do you know what we
-
Not Syncedhave figured out how to do with processors
-
Not Syncedthat has made our battery lives improve
-
Not Syncedover time? We figured out how to turn them off.
-
Not SyncedThis is literally how your phone, your
-
Not Syncedlaptop, like if you have your computer
-
Not Syncedon your desk. Every single
-
Not Syncedmicroprocessor, general purpose
-
Not Syncedmicroprocessors you can get today.
-
Not SyncedThe way it conserves power is by
-
Not Syncedturning itself off as rapidly and as
-
Not Syncedfrequently as possible for as long a
-
Not Syncedperiod time as possible. The more
-
Not Syncedyour processor turns on, the less this
-
Not Syncedlittle green goes yellow and then red.
-
Not SyncedBad stuff right? So we actually want to
-
Not Syncedmake code faster in order to save battery
-
Not Syncedlife. Universally, this is true.
-
Not SyncedThere are some extreme exceptions to it
-
Not SyncedThere'e some really weird stuff around
-
Not Syncedout on the fringe. But 99.999999% of the time
-
Not SyncedYou want to run code faster to save
-
Not Syncedbattery. But batteries aren't the only
-
Not Syncedstory when it comes to saving power.
-
Not SyncedThis is one of Google's data centers.
-
Not SyncedYou'll note that this is a very large building
-
Not Syncedand the only thing it is doing is taking
-
Not Syncedelectricity and turning it into heat.
-
Not SyncedThat is it's job. And it's really good
-
Not Syncedat it's job. And unfortunately,
-
Not Syncedelectricity costs a lot of money.
-
Not SyncedAnd in fact, it's a finite resource.
-
Not SyncedThere's a certain point at which the cost
-
Not Syncedgoes away, you simply cannot have any
-
Not Syncedmore electricity at a particular point
-
Not Syncedin time. And so power becomes very, very
-
Not Syncedimportant in a data center as well.
-
Not SyncedAnd I find it interesting that it's on the
-
Not Syncedtwo extremes of computing platforms that
-
Not Syncedwe find convergence. Right? When you drop
-
Not Syncedto a phone, or you go up to a data center
-
Not Syncedall of a sudden power dominates. Right?
-
Not SyncedWe'll talk about compute per watt.
-
Not SyncedThis is another picture of the data center
-
Not Syncedby the way. I just want to clarify what
-
Not Syncedthis is. This is one of my favorite pictures
-
Not SyncedThose are enormous vents blowing out stem vapor.
-
Not SyncedI don't know much about this but
-
Not Syncedapparently when you can see the water vapor
-
Not Syncedthe data center is operating at peak
-
Not Syncedefficiency because it means it's not too hot,
-
Not Syncedits not too cool, its actually efficiently
-
Not Syncedcooling the ?. Anyway this is trivia.
-
Not SyncedSo the compute per watt tends to
-
Not Synceddominate in the data canter and this is
-
Not Syncedactually kind of the same thing we're trying
-
Not Syncedto pull off on a phone or anything else.
-
Not SyncedWe want to maximize how much compute
-
Not Syncedwe can get out of the watts we're going
-
Not Syncedto burn when the chip is turned on.
-
Not SyncedMakes sense? Alright? Now I say raw speed
-
Not Syncedisn't everything because when we talk
-
Not Syncedabout performance is really important
-
Not Syncedyou'll get some mixed messages from people.
-
Not SyncedHow many folks have heard this adage:
-
Not SyncedAfter all, Java is faster than C++
-
Not Syncedhow many folks have heard it?
-
Not SyncedOh, you can be honest, I've heard it!
-
Not SyncedAll right, I had James Gosling sit across
-
Not Syncedfrom the table and tell me
-
Not SyncedI was a complete moron because I didn't
-
Not Syncedbelieve Java that was faster than C++.
-
Not SyncedAnd at the time he was right.
-
Not SyncedAnd I learned better.
-
Not SyncedSo it turns out that Java is faster than C++
-
Not Syncedin certain areas and scenarios.
-
Not SyncedFor example if you have a specific application
-
Not Syncedand your specific application is going to
-
Not Syncedrun for a long period of time
-
Not Syncedand you're concerned about the ?
-
Not Syncedof the application and you have a
-
Not Syncedvery well tuned virtual machine
-
Not Syncedfor your Java, and you've tuned
-
Not Syncedthe garbage collector to precisely match
-
Not Syncedthe desired kind of garbage collection
-
Not Syncedinterruption frequency for your application
-
Not SyncedIf you get all of that, Java will
-
Not Syncedvery often ? perform to C++. 9:26
- Title:
- CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"
- Description:
-
- Video Language:
- English
- Team:
- Captions Requested
Show all