metrica-plugin-unity icon indicating copy to clipboard operation
metrica-plugin-unity copied to clipboard

Unity with iOS target (and probably other platforms) ReportEvent with parameters forces Boxing Allocations

Open HitCache opened this issue 3 years ago • 1 comments

Hi @NesterovichAlexey

To use ReportEvent with parameters forces a Dictionary<string, object> which means there will always be boxing allocations to convert to object.

Since it passes the dictionary to ymm_reportEventWithParameters (message, JsonStringFromDictionary (parameters)) internally could we have another non-allocating method exposed please? one that accepts a json string that we created?

for example something like:

public override void ReportEvent (string message, string parametersJsonString)
    {
        ymm_reportEventWithParameters (message, parametersJsonString);
    }

then we could generate our own JSON string without alloc via another library or whatever.

If you like this idea but are too busy to implement please let me know and I will submit pull request!

HitCache avatar Aug 16 '20 13:08 HitCache

Hi @HitCache Thank you for the offer. We will add this feature in the next release.

NesterovichAlexey avatar Aug 17 '20 12:08 NesterovichAlexey