Skip to content

Performance issue in CharVector.CopyTo when calling RemoteConfig.GetValue #743

Open
@jjfmarket

Description

@jjfmarket

Please fill in the following fields:

Unity editor version: 2018.4
Firebase Unity SDK version: Firebase Remote Config Version 6.15.2
Source you installed the SDK (.unitypackage or Unity Package Manager): Unity Package Manager
Firebase plugins in use (Auth, Database, etc.): RemoteConfig
Additional SDKs you are using (Facebook, AdMob, etc.):
Platform you are using the Unity editor on (Mac, Windows, or Linux): All
Platform you are targeting (iOS, Android, and/or desktop): iOS, Android
Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

  1. Setup the firebase quickstart for unity remote config testapp
  2. Add a very long string as a Remote config value with the key 'really_big_string'
  3. Fetch the remote config with FirebaseRemoteConfig.FetchAsync
  4. Call FirebaseRemoteConfig.GetValue("really_big_string");

Note that the amount of time the FirebaseRemoteConfig.GetValue takes scales linearly with the number of bytes in the string.
If you step into the GetValue call you can observe the CharVector.CopyTo calls Array.Copy for every byte in the string, rather than doing a single Array.Copy for the entire string.

For larger strings this ends up taking quite a bit of time, and can cause a framerate loss.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
Yes

What's the issue repro rate? (eg 100%, 1/5 etc)
100%

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions