Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the profiler in unity to identify where to optimize performance #641

Closed
Rain1618 opened this issue Oct 24, 2024 · 1 comment
Closed
Assignees

Comments

@Rain1618
Copy link
Collaborator

No description provided.

@Rain1618
Copy link
Collaborator Author

Tancrede's results:

I ran the profiler on the SquarePool Scene. Here are the main culprits (tested in editor mode, on my local machine directly—no containers):

Current High-Latency Events (by CPU Usage, Descending):

  • On average

    • Camera rendering
    • Monobehaviour updates
      • Thrusters.Update() & ROSClock.Update()
    • Canvas updates (UI)
    • ROS camera publishers at EndOfFrame
      • CameraPublisher.SendImage() & CameraDepthPublisher.SendImage()
    • Physics updates
  • Spikes (consistently every ~13 frames)

    • !! ROS camera publishers at EndOfFrame
      • SendImage(): specifically, garbage collection (GC) is causing the spikes.

Observations

  • The two ROS camera publishers are incurring significant latency due to:

    • ros.Publish() calls
    • Pre-computation within each camera publisher's SendImage() methods
    • Garbage collection spikes after/before the next SendImage() calls

    Suggestion: Caching some data may help reduce the load on the garbage collector?

  • Physics updates contribute a smaller, yet still notable CPU load (5-10%). This mainly stems from:

    • The thruster script
    • ROSClock (to a lesser extent)

    Suggestion: optimize any math/physics computations for efficiency?

  • UI updates also add to CPU usage slightly, though not heavily.

    • Suggestion: Try simplifying the UI in terms of types and amounts of components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants