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

(Case 1290128) [Android] Resources.LoadAll slow when (LZ4/LZ4HC) compression is applied

Discussion in '2020.2 Beta' started by kleicht, Nov 4, 2020.

  1. kleicht


    Aug 1, 2018
    I'm trying to load text assets from Resources folder with Resources.LoadAll<TextAsset>() method.
    In version 2020.2.0b9.3373 it became more then 10 times slower compared to 2020.1.11f1 if either LZ4 or LZ4HC compression is applied to the build.
    It gets increasingly worse if other packages/plugins create assets under resources folder. So more than likely it has to do something with resources folder size.

    Folder A
    byte asset size: 131072 byte
    byte asset count: 1
    Folder B
    text asset size: 256 byte
    text asset count: 600

    Reading text files only from folder B.
    (Version / Compression method / time )

    2020.1.11f1 DEF 167 ms
    2020.1.11f1 LZ4 140 ms
    2020.1.11f1 LZ4HC 155 ms

    2020.2.0b9.3373 DEF 66 ms
    2020.2.0b9.3373 LZ4 2100 ms
    2020.2.0b9.3373 LZ4HC 1911 ms
    Peter77 likes this.
  2. Claytonious


    Feb 16, 2009
    I would strongly advise you to follow Unity's published best practices for this as shown in their whitepapers and on their tutorials site:

    ... if that's possible in your scenario.