Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Huge array system slow but fps shows over 100?

Discussion in 'Scripting' started by tawdry, Mar 15, 2015.

  1. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    So i wanted to see the effect of a huge array. I made a 50000 slotter unpopulated and ran the game with profiler open all the stats showed normal numbers no fps drop no memory spike nothing but my game was a slideshow. Where does the impact of an array occur?
     
  2. ricardo_arango

    ricardo_arango

    Unity Technologies

    Joined:
    Jun 18, 2009
    Posts:
    64
    The impact of the array will be in the memory used and in garbage collection. If your array is of value types, then it will not have a performance impact in the garbage collector while it's kept in memory, it will have an impact when the array memory is collected. If you have reference types in your array, then it will increase the time the garbage collection takes to process the references in the array, regardless of that array being collected or not, because it has to be traversed during the process.

    I suggest you have a look at this talk for a very good introduction to scripting and memory management in Unity :
     
  3. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    Well thats 30 mins of my life i can't ever get back:p. last few minutes were informative but most of it flew over my head tbh.I Thx for the tut.