Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by stingman · Dec 11, 2012 at 02:44 AM · iphonexcodeprofilercpuoptimize

Analyzing iPhone Profiler in Xcode to increase game's performance

I read over the documentation and I realize that some of my numbers seem rather large. I'm trying to optimize as best I can for iPhone 3GS/4. The game runs pretty smooth on iPhone 4S, iPad 3/4 and iPhone 5. I know the older processors don't have nearly the same power but I'm doing my best to optimize my game. Currently the profiler is displaying the following stats. If anyone has some suggestions as to how to increase performance for iPhone 3GS/4 that would be great. I'm trying to wrap my head around how to do this based off of the limited information in the Unity Docs regarding the iPhone Profiler.

 iPhone Unity internal profiler stats:
 cpu-player>    min: 85.8   max: 154.7   avg: 116.9
 cpu-ogles-drv> min:  3.2   max: 37.6   avg:  9.0
 cpu-waits-gpu> min:  1.2   max: 28.6   avg:  9.1
  msaa-resolve> min:  0.0   max:  0.0   avg:  0.0
 frametime>     min: 121.1   max: 184.2   avg: 142.4
 draw-call #>   min:  51    max:  62    avg:  55     | batched:    16
 tris #>        min: 19415  max: 23390  avg: 21459   | batched:  2147
 verts #>       min: 22621  max: 27084  avg: 25012   | batched:  1089
 player-detail> physx: 28.2 animation:  3.3 culling  0.0 skinning:  0.2 batching:  3.5 render: 13.2 fixed-update-count: 12 .. 19
 mono-scripts>  update: 13.1   fixedUpdate:  2.7 coroutines:  0.4 
 mono-memory>   used heap: 798720 allocated heap: 1695744  max number of collections: 1 collection total duration: 25.1


Thanks!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image stingman · Dec 11, 2012 at 09:12 AM 0
Share

Thanks Jake. you brought up a good point about caching component references. I usually do scripts but I'm going to cache everything and see how this works. I already improved performance a little bit by combining some meshes and lowering texture quality but I think the problem lies in the scripting. I just have way too much going on and I'm calling components at runtime like crazy. I'll def cache everything and I'll let you know how it works out :) TY for the tips.

avatar image DannyB · Dec 11, 2012 at 09:32 AM 0
Share

Great comment Jake. Is transform one of the components you cache?

avatar image Jake.OConnor · Dec 11, 2012 at 07:37 PM 0
Share

In my projects I cache EVERY component (only if the GO has them, of course). It's unbelievably faster than using GetComponent() every time.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Jake.OConnor · Dec 11, 2012 at 05:18 AM

I don't have any iPhone specific solutions, so I'm not posting this as an answer, but I'll mention some various ways to increase performance in general.

1) Cache the default component references. Instead of using .animation, .renderer, etc all the time in your scripts, cache a copy of these references to private variables in your Start() or Awake() function. When you use .animation is takes just as long as calling .GetComponent(), which is a long time if you add it up. I had a project running at about 40fps, cashed all those references and it ran at about 130fps w/o any change to functionality.

2) Get rid of any empty Unity functions (Update(), LateUpdate(), etc). Even if empty, they get called and that takes time.

3) Turn off VSync. If you're having terrible screen tearing with VSync off, leave it on, but otherwise leave it off. Depending on the program you can get your fps up by about 500% by turning VSync off (because your program doesn't have to wait for the refresh).

4) Use Coroutines if possible. Not only are they great for functionality, but they allow you to do a lot of things that would eat up a lot of CPU cycles without them. (e.g. Trying to wait for 10 seconds in Update() would require update to be called 10 * fps times, where you could have a coroutine just yield until 10 seconds is up.)

Like I said, these are just some hints to maximize performance on any system.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

CPU Usage Question (iOS) 0 Answers

iPhone Performance Question relating to CPU-WAITS-GPU 1 Answer

Call another file of click event of button in iphone 0 Answers

Unity to xCode to iOS device problem 1 Answer

Jumping to high 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges