So you finish writing your app and it's ready to go, right?
It might not be.
Have you heard of performance theory,
and how to check that your app is at its best?
My name is Joanna Smith.
And I'm here to introduce you to the performance tuning
lifecycle, so that you will know when,
and how, to optimize your app.
The truth is that most developers
don't think about performance until it has already
become a problem.
Which, of course, usually happens when you're up
against a deadline, the coffee is gone,
and there's a weird man smell lingering in the office.
But in times like these, keep calm.
Don't panic.
Because fixing performance problems
is straightforward with the performance tuning lifecycle.
There's only three steps.
Gather, insight, and action.
Even if you've found your performance problem,
it may not be immediately clear what is triggering it.
And that brings us to phase 1, gathering information.
The easiest way for you to do that
is to use a tool that gathers the data for you.
Now most tools are built for a specific purpose.
Some are specialized for memory information or GPU performance
or battery usage.
All this means is that you'll most likely
need to run several different tools in order to figure out
what's really going on.
The key to success here is knowing which tool
to use to understand what data.
So you know where in your app to look so
that you can fix your problem.
But once you have all of that data,
do you know how to read it?
Most of the time you're going to be stuck
with a bunch of numbers or lines,
or just junk that looks like Greek.
So now comes phase 2, gaining insight.
When it comes down to it, you're trying
to identify your problem out of a whole bunch of nonsense.
So you might rely on these tools to help you format the data
and make it readable.
But even then, you need to understand what it means.
And how it applies to your app.
For example, Heap Viewer may look really intimidating.
But knowing how to read it will help you realize that all
you're seeing here are bitmap objects
lingering on the heap across activity transitions.
And now you've got something you can work on.
Now unfortunately, steps 1 and 2 aren't linear.
They're circular.
This means that sometimes you'll open a tool, grab some data,
interpret it, and that'll just lead you to another tool.
Consider Traceview, which may show you
a horde of garbage collection events occurring
during your scroll event.
The insight here is that something
is going crazy with memory.
Which means that you can switch over to the Allocation Tracker,
and see what's causing all the fuss.
So by the time you reach phase 3, you might be kind of tired.
But take a breath.
Because this step is often the hardest.
Taking action.
This is where you will move past all
of those numbers and insights to actually go fix your problem.
But be careful.
Performance fixes aren't just about code.
Of the three stages, this the most human.
Because solving the problem isn't enough.
You need to solve it in a way that
meets your coding standards and your design constraints,
and can be done under a deadline.
So make sure that you have a plan before you run off
and fix things.
But now you're done.
Congrats!
JK, you guys.
Because as long as your application
is even a bit wonky, you'll be going through this lifecycle
over and over and over again on various parts of your code
base.
To get your app truly running smooth,
every single piece needs to be optimized for performance.
And that's why you should check out the rest of the Android
Performance Patterns resources to help
you know what tools to use, what they mean,
and how to solve your problems.
And don't forget to join the Google+ community, as well.
Because you can get insight from other folks who've already
had these problems.
So keep calm.
Profile your code.
And always remember, perf matters.