Search Unity

Android WWW read is magnitudes slower than all other platforms.

Discussion in 'Editor & General Support' started by par-002, Mar 13, 2014.

  1. par-002

    par-002

    Joined:
    Jul 4, 2012
    Posts:
    52
    I have no idea why but my file read times are atrocious. My current build works on Windows, Mac, iOS and Android. While I do a lot of File I/O in the beginning to load information for runtime, for the same level these are my read times:


    • Windows - 2.3s (no fair, desktop)
    • OSX - 2.8s (no fair, laptop)
    • iOS iPhone 4 - 6.2s
    • iOS iPhone 5 - 5.7s
    • Android Galaxy S3 - 19.1s
    • Android Galaxy S4 - 15.9s
    • Android Nexus 7 - 21.2s
    • Android Galaxy Tab 2 - Anywhere between 22s and 35s!

    The files are exactly the same... the data is the same. And they are just text files. Is there anything I can do to speed this up?

    Also, when I went from System.IO.StreamReader to WWW (to get cross platform w/ same code), ALL reads doubled. Meaning, when I was doing the reads with System.IO.StreamReader you can cut those times in half (except the Android times as they simply did not work).

    Thanks!

    PAR
     
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    and here lies the magic. on Android APK is actually a huge zip (NOT unpacked at install), so you pay the cost of searching, unpacking, reading.
     
  3. par-002

    par-002

    Joined:
    Jul 4, 2012
    Posts:
    52
    Thank you for the response.

    Is there any way when the game is first started (after installation) to unpack files into some kind of storage area and keep them unpacked?

    PAR
     
  4. par-002

    par-002

    Joined:
    Jul 4, 2012
    Posts:
    52
    So, is there any standard procedure of unpacking files after installation (or first run) so that we don't have to deal w/ the extra overhead of unarchiving every time we read a file?

    Thanks!

    PAR