Hello here :wave:. I’m investigating how to get a ...
# compose
j
Hello here 👋. I’m investigating how to get a view tree from a ✏️ screen, in an efficient manner. I have tried to use Radiography from Square, but it uses
composer.compositionData.asTree()
, which is too slow for my needs (500ms for a simple view). There is also Semantics, used by Talkback, it seems lighter, but is not used for every composable/Group, especially for custom views. I talked a bit about my problem with a person from Google at Android Makers this monday (sorry I don’t remember your name, maybe @Clara Bayarri) and I will be happy to continue the discussion here. Is there an efficient solution that can be found by using SlotTables/Group directly? I will buy the book Jetpack Compose Internals to go further but any help to move faster will be welcome, thank you 🤓.
z
Even LayoutInspector, which, of all the tools doing this sort of thing, probably has the most performance work going into it, will add significant latency to an app when live refresh is turned on. I think the fact is that Compose is not designed to be inspectable in this way in a super efficient way because it’s not needed for doing it’s primary job: managing internal-only trees of UI. Any additional support for publishing this metadata would add extra work, which would slow the runtime down. Since this sort of thing should only used for debugging, it’s an acceptable tradeoff to make it slower if it keeps the regular runtime faster. (Disclaimer: I’m speculating, but pretty sure this is it.)
So two questions: 1. Why are you trying to get the tree? 2. What are you trying to do with it?