You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe with reproduction steps – What is the expected behavior? TCString.encode(model) is very slow because most of its runtime is spent in stringifying and parsing the GVL JSON as part of a clone() operation in the TCModel. The TCModel has gvl and publisherRestrictions members where the publisherRestrictions itself has a gvl member too. This results in the GVL being cloned twice as can be seen in this Performance overview:
As Google is increasingly focusing on the INP CoreWebVital metric it is almost impossible to score favorably because of the bad performance of the encode operation. Google recommends to make sure the JavaScript main thread is not kept occupied more than 50 ms for each task for improved user experience. The task in the screenshot took 120 ms of which approx. 75 ms were spent in two getJson() calls.
Is there any reason why the GVL is cloned twice and why it is implemented like:
Regarding "Is there any reason why the GVL is cloned twice and why it is implemented like:(https://github.com/InteractiveAdvertisingBureau/iabtcf-es/blob/master/modules/core/src/GVL.ts#L403-L417)". I think the double clone is a side effect of us calling two static JSON functions to get a JSON object. I don't know why this was done this way. I loop in IAB TechLab folks to help review and debug this. In the meantime if anyone has any idea how this can be approved, feel free to suggest it. this library is open source, meaning we are happy for your contribution.
it seems you shouldnt need to do all the json calls. To get the object stripped to just what you need, which seems to be the goal of the function, you can do something like this. I put in a pr to try and avoid them
Version
1.5.11
Module (core, cmpapi, cli, stub, or testing)
core
Describe with reproduction steps – What is the expected behavior?
TCString.encode(model)
is very slow because most of its runtime is spent in stringifying and parsing the GVL JSON as part of aclone()
operation in the TCModel. The TCModel hasgvl
andpublisherRestrictions
members where thepublisherRestrictions
itself has agvl
member too. This results in the GVL being cloned twice as can be seen in this Performance overview:As Google is increasingly focusing on the INP CoreWebVital metric it is almost impossible to score favorably because of the bad performance of the encode operation. Google recommends to make sure the JavaScript main thread is not kept occupied more than 50 ms for each task for improved user experience. The task in the screenshot took 120 ms of which approx. 75 ms were spent in two getJson() calls.
Is there any reason why the GVL is cloned twice and why it is implemented like:
(https://github.com/InteractiveAdvertisingBureau/iabtcf-es/blob/master/modules/core/src/GVL.ts#L403-L417)
The text was updated successfully, but these errors were encountered: