Return to Video

CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"

  • Not Synced
    So hi there, everyone.
  • Not Synced
    My name is Chandler Carruth.
  • Not Synced
    I work for Google
  • Not Synced
    I work on our C++ language platform
  • Not Synced
    I work on our C++ compilers
  • Not Synced
    specifically the Clang and LLVM teams at Google
  • Not Synced
    And I'm here to talk to you a little about performance.
  • Not Synced
    and efficiency, and making code fast,
  • Not Synced
    and all the different things that go into that.
  • Not Synced
    But before I do too much
  • Not Synced
    I want to give actually give you guys a little bit of
  • Not Synced
    one might say are expectations.
  • Not Synced
    Because I have been reading the twitter feed
  • Not Synced
    from all these folks, that talk about all these crazy good questions
  • Not Synced
    I just want you guys to essentially know this is my view
  • Not Synced
    of what Performance 101 should be.
  • Not Synced
    Okay? This is going to be kind of an intro talk.
  • Not Synced
    You guys are hard core, really deep performance nuts.
  • Not Synced
    You may be a little bit bored, and please be kind,
  • Not Synced
    because I'm going to gloss over some things
  • Not Synced
    you could heckle me thoroughly if you really want to
  • Not Synced
    We're going to talk about efficiency, performance,
  • Not Synced
    algorithms and data structures.
  • Not Synced
    And the first thing we are going to do is we're not going to talk about them.
  • Not Synced
    We're going to talk about why anyone cares about them.
  • Not Synced
    How many folks here think it's really important
  • Not Synced
    to have high performance in C++?
  • Not Synced
    Raise your hand if think that it's super important.
  • Not Synced
    Everyone thinks it's important!
  • Not Synced
    And the folks here who have a really clear idea why performance is important.
  • Not Synced
    Now, all the people who didn't raise their hands the second time,
  • Not Synced
    Please reconsider raising your hand the first time.
  • Not Synced
    We actually need to understand why performance is important in C++,
  • Not Synced
    before we actually decide it's important, we're going to care a lot about it.
  • Not Synced
    I'm going to tell you why I care about performance in C++.
  • Not Synced
    Most of it comes down to a quote from Nicolas Werth.
  • Not Synced
    Which I will try to pronounce correctly but fail miserably.
  • Not Synced
    I actually really like a lot of our stuff,
  • Not Synced
    I think he encapsulates a lot of my thoughts,
  • Not Synced
    what's core to my philosophy here.
  • Not Synced
    The software is getting slower more rapidly than
  • Not Synced
    hardware becomes faster.
  • Not Synced
    This is particularly in contrast to
  • Not Synced
    the kind of normal Moore's Law approach:
  • Not Synced
    Hardware's getting faster, all the time
  • Not Synced
    it's okay, we don't need to make software faster,
  • Not Synced
    because the hardware will catch up.
  • Not Synced
    And it turns out that's not really true.
  • Not Synced
    We're really good at writing slow software.
  • Not Synced
    Even in C++, we're really good at writing slow software.
  • Not Synced
    It's hard to write fast software,
  • Not Synced
    and it takes a lot of effort.
  • Not Synced
    And so it's important to think about
  • Not Synced
    why that might matter no matter how fast
  • Not Synced
    the processors get.
  • Not Synced
    And to give you an idea of just how much
  • Not Synced
    I think Nicholas Werth is on the same page
  • Not Synced
    I just have to mention he actually wrote a book
  • Not Synced
    entitled Algorithms + Data Structures = Programs.
  • Not Synced
    I did not realize this as I was picking
  • Not Synced
    the title of the topic.
  • Not Synced
    Anyways, we're going to come back
  • Not Synced
    to the title of this book.
  • Not Synced
    Because he predicted some whole elements
  • Not Synced
    of this talk in this book.
  • Not Synced
    So how many folks here have read this book?
  • Not Synced
    Anyone? All right! A long time ago.
  • Not Synced
    It's a good book. It's a good book.
  • Not Synced
    Okay, so I actually think the idea that
  • Not Synced
    software is getting slower too quickly, right?
  • Not Synced
    is really getting slower at an astonishing
  • Not Synced
    rate is even more important than before.
  • Not Synced
    And for pretty specific reasons.
  • Not Synced
    There was a very seminal event that
  • Not Synced
    happened in the technology world some time ago
  • Not Synced
    that changed, in my opinion and a lot of
  • Not Synced
    other peoples' opinion, how we look at
  • Not Synced
    computing devices, the performance of
  • Not Synced
    computing devices, the challenges we face
  • Not Synced
    running software for computing devices.
  • Not Synced
    And this event was the iPhone. Okay?
  • Not Synced
    And when Steve Jobs introduced the iPhone,
  • Not Synced
    he was not doing anything particular to C++
  • Not Synced
    but he was changing how we
  • Not Synced
    think about computing.
  • Not Synced
    Mobile was now a first class compute citizen.
  • Not Synced
    It took the world a little while to even
  • Not Synced
    realize that that was what had happened that day.
  • Not Synced
    But that's what happened.
  • Not Synced
    We now have to care about mobile.
  • Not Synced
    We have to care about things that are small.
  • Not Synced
    Right? things that are hard and challenging
  • Not Synced
    to fit big bulky systems into.
  • Not Synced
    And we essentially get into this annoying
  • Not Synced
    situation of, we have small, we have fast
  • Not Synced
    machines. We have to choose one.
  • Not Synced
    We don't get to choose though.
  • Not Synced
    We're going to choose small almost every time.
  • Not Synced
    But it gets worse.
  • Not Synced
    Because the other problem that the iPhone
  • Not Synced
    introduced that people weren't
  • Not Synced
    really focused on at the time
  • Not Synced
    was the problem of a battery.
  • Not Synced
    What do we do about the battery in your phone?
  • Not Synced
    You phone's battery, I mean my phone's
  • Not Synced
    battery is about dead. Right?
  • Not Synced
    How many folks here have charged their
  • Not Synced
    phone today? (Laughter from audience) Okay?
  • Not Synced
    That's a problem. That's not a feature.
  • Not Synced
    That's a bug. (Laughter from audience) Okay?
  • Not Synced
    Yes, How many folks are charging their phone now?
  • Not Synced
    (Laughter from audience) Okay so we kind of
  • Not Synced
    entered this new problem domain, suddenly
  • Not Synced
    power became relevant.
  • Not Synced
    There's some kind of shady research I want
  • Not Synced
    to push back against.
  • Not Synced
    There's some research into power efficient
  • Not Synced
    instructions. If you ever read about power
  • Not Synced
    efficient instructions or optimizing
  • Not Synced
    power usage, you should become very suspicious.
  • Not Synced
    And you should probably run the other direction.
  • Not Synced
    Because this is mostly total junk science. Okay?
  • Not Synced
    Here's the number one leading theory
  • Not Synced
    about how to save this, how to save
  • Not Synced
    battery life. Finish running the program.
  • Not Synced
    (Audience laughter) Seriously, race to sleep.
  • Not Synced
    That's the actual technical term, race to sleep.
  • Not Synced
    The faster your software runs, the less
  • Not Synced
    power it consumes. Now people get really
  • Not Synced
    upset about this. No, no if I run
  • Not Synced
    software really fast, then it heats up my
  • Not Synced
    processor, all that excess heat, that's the
  • Not Synced
    wasted power. But it's not, okay? Here's
  • Not Synced
    the thing, we've never really figured out
  • Not Synced
    how to run processors and do work
  • Not Synced
    on processors in a
  • Not Synced
    power efficient way. Do you know what we
  • Not Synced
    have figured out how to do with processors
  • Not Synced
    that has made our battery lives improve
  • Not Synced
    over time? We figured out how to turn them off.
  • Not Synced
    This is literally how your phone, your
  • Not Synced
    laptop, like if you have your computer
  • Not Synced
    on your desk. Every single
  • Not Synced
    microprocessor, general purpose
  • Not Synced
    microprocessors you can get today.
  • Not Synced
    The way it conserves power is by
  • Not Synced
    turning itself off as rapidly and as
  • Not Synced
    frequently as possible for as long a
  • Not Synced
    period time as possible. The more
  • Not Synced
    your processor turns on, the less this
  • Not Synced
    little green goes yellow and then red.
  • Not Synced
    Bad stuff right? So we actually want to
  • Not Synced
    make code faster
  • Not Synced
    There are some extreme exceptions to it
  • Not Synced
    But 99.999999% of the time
  • Not Synced
    But batteries aren't the only
  • Not Synced
    You'll note that
  • Not Synced
    The only thing it is doing is taking electricity and turning it into heat.
  • Not Synced
    That is it's job
  • Not Synced
    And unfortunately, electricity costs a lot of money
  • Not Synced
    And so power becomes very, very important
  • Not Synced
    And I find it interesting
Title:
CppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"
Description:

more » « less
Video Language:
English
Team:
Captions Requested

English subtitles

Incomplete

Revisions Compare revisions