[Touch-packages] [Bug 1343198] Re: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common)
** Summary changed: - Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) + [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to libhybris in Ubuntu. https://bugs.launchpad.net/bugs/1343198 Title: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common) Status in Mir: In Progress Status in “libhybris” package in Ubuntu: In Progress Bug description: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many times) of a large list of strings using strmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. To manage notifications about this bug go to: https://bugs.launchpad.net/mir/+bug/1343198/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1343198] Re: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common)
Hmm, consistent profile results seem to tell me that the offending code is possibly only called on startup. But if the startup code accounts for 12% of the CPU time of something I left rendering for several minutes, it's still worth fixing. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to libhybris in Ubuntu. https://bugs.launchpad.net/bugs/1343198 Title: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common) Status in Mir: In Progress Status in “libhybris” package in Ubuntu: In Progress Bug description: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many times) of a large list of strings using strmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. To manage notifications about this bug go to: https://bugs.launchpad.net/mir/+bug/1343198/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1343198] Re: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common)
Here's a patch where I've converted the linear search into a binary search. Performance is improved by a factor of approximately 10. Even if this code is only touched on startup, it's definitely worth having because this represents most of the startup time of the Mir server. ** Patch added: bsearch.patch https://bugs.launchpad.net/ubuntu/+source/libhybris/+bug/1343198/+attachment/4154608/+files/bsearch.patch ** Description changed: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many - times) of a large list of strings using strmp alone. That's why 22132 + times) of a large list of strings using strcmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. ** Summary changed: - [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) + [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) comparing strings when it should be rendering -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to libhybris in Ubuntu. https://bugs.launchpad.net/bugs/1343198 Title: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common) comparing strings when it should be rendering Status in Mir: In Progress Status in “libhybris” package in Ubuntu: In Progress Bug description: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many times) of a large list of strings using strcmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. To manage notifications about this bug go to: https://bugs.launchpad.net/mir/+bug/1343198/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1343198] Re: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) comparing strings when it should be rendering
Did you test the upstream implementation first to see if that is already enough for you? While I like the change you proposed, that would differ us from upstream, and the next rebase would mean dropping your change. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to libhybris in Ubuntu. https://bugs.launchpad.net/bugs/1343198 Title: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common) comparing strings when it should be rendering Status in Mir: In Progress Status in “libhybris” package in Ubuntu: In Progress Bug description: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many times) of a large list of strings using strcmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. To manage notifications about this bug go to: https://bugs.launchpad.net/mir/+bug/1343198/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1343198] Re: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) comparing strings when it should be rendering
I think hashing (upstream hybris) is a better idea and we should jump to that when possible. Although I just assumed we had no intention of rebasing given the significant diff. If we can then we should. I don't know what the performance diff to upstream is but upstream's hashing should possibly be even better than the bsearch.patch. bsearch.patch is a short-term solution and long term we should rebase when possible. ** Summary changed: - [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) comparing strings when it should be rendering + [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris-common) comparing strings ** Changed in: libhybris (Ubuntu) Importance: Undecided = Medium -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to libhybris in Ubuntu. https://bugs.launchpad.net/bugs/1343198 Title: [android] Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common) comparing strings Status in Mir: In Progress Status in “libhybris” package in Ubuntu: In Progress Bug description: On the N4, Mir spends 12%+ CPU time in get_hooked_symbol (libhybris- common). Actually callgrind can't decide; it's somewhere between 12% and 46000% ;) So it's big. Looking at the hybris code, there's a rather large bottleneck that's obvious: get_hooked_symbol does a linear search (many times) of a large list of strings using strcmp alone. That's why 22132 calls to get_hooked_symbol are yielding over 5 million calls to strcmp. Upstream hybris appears to have been modified to use a cache/hashing instead of the ugly linear search we have. To manage notifications about this bug go to: https://bugs.launchpad.net/mir/+bug/1343198/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp