Uh oh!
There was an error while loading. Please reload this page.
Tune element UID generation - #65
Conversation
| int processId = element.processIdentifier; | ||
| uint8_t b[16] = {0}; | ||
| memcpy(b, &elementId, sizeof(long long)); | ||
| memcpy(b + sizeof(long long), &processId, sizeof(int)); |
There was a problem hiding this comment.
I was thinking about this yesterday; perhaps you want to assert that sizeof(long long) + sizeof(int) < 16, although that's guaranteed to be the case on 32-bit and 64-bit platforms.
qmfrederik
commented
Mar 28, 2018
Looks good to me - thanks for picking this up! To recap, XCUITest uses 'proxy' objects which point to the actual UI elements. Every time you query for an element, you get new proxy objects - even if they point to the same underlying UI element. This PR changes the algorithm which assigns UUIDs to XCUIElements so that it is 'deterministic' - in that two XCUIElements which point to the same UI element will have the same UUID. This will have a positive impact on the element cache size - querying the same element 1000 times would result in ~125MB memory consumption in the current WebDriverAgent implementation; with this fix the memory consumption is reduced to ~25MB. Together with the ideas discussed in in facebookarchive#896, this should seriously reduce the memory consumption of the element cache. |
…o new_uid # Conflicts: # WebDriverAgentLib/Routing/FBElementCache.m
@qmfrederik Can you please help to update cache unit tests after merge? |
mykola-mokhnach
commented
Mar 29, 2018
nwm, I've figured it out myself: d7061da |
The idea is based on facebookarchive#897 by @qmfrederik. The change allows to nicely optimise the size of the internal cache.