amplitude / unity-plugin

Official Amplitude Unity Plugin
https://developers.amplitude.com/docs/unity
MIT License
44 stars 34 forks source link

Ability to pass already formed json string to functions instead of a Dictionary/List/etc #86

Closed ByMedion closed 2 years ago

ByMedion commented 3 years ago

Summary

For example, take the logEvent method: void logEvent(string evt, IDictionary<string, object> properties)

It would be really nice to have an overload to which the already prepared json string could be sent: void logEvent(string evt, string propertiesJson)

Motivations

1) Convenience. 2) Optimization. There may be cases when a StringBuilder is externally used to form a json string so as not to allocate extra memory for serializing the dictionary. Also, that StringBuilder can be reused every time, unlike built-in MiniJSON, which allocates new StringBuilder each time.

dantetam commented 2 years ago

Hello @ByMedion , this is an interesting use case. Does this amount of memory used in a dictionary affect devices? Does this affect device performance with many events?

dnshi commented 2 years ago

Since we don't hear back from the issue creator with any further information, close this issue thread. Please let me know if there is any further question or issue regarding this case. Thanks.