What way do you find optimize performance/find bottlenecks?

Hi, first of all I’ll tell you a bit about my situation. I’m a java-student currently working as an intern at a company developing Android apps. (Also sorry about any grammatical errors, English is not my native language.)

I got a project from my mentor trying to find performance issues/bottlenecks in one of his applications. The app itself was not very slow, but sometimes it lagged on specific devices and we had no idea why.

I used android studios heapview and traceview, but all info I got out was that the only thing slowing it down was underlying methods (mostly graphics) that I am not able to affect in any way. I’m wondering if there is any other way, perhaps some 3rd party application, that can check my performace during a test that YOU prefer to use?

Honestly the heapview I could not make much sense of, the Traceview was interesting, and seemed straight to the point I was looking for, but all the mixing with methods that is irrelevant to me makes it so much harder to filter out the information I want.

So, to make it simple, I would like some tips on ways you try to optimize your performance for an Android app.

When I was a tiny little lad, back in the days of spinning wheels and witchcraft, I was told that when writing games ALWAYS use integers where ever possible, reduce the number of jumps, calls etc. to as few as possible, write linear code… it makes longer/more source code but faster running code, especially with multi-threading pipe things - However, these were the days of 4.77MHz processors, so I suppose most of that is redundant now. If there is a bottle neck it is probably hardware related, your code is twiddling it’s binary thumbs waiting for a lagging screen or audio device to complete it’s simple task - which would explain why it isn’t on all the appliances! Sometimes buying a cheap device is a false economy - it’s cheap for a reason.