Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark for Compose #169

Closed
maxmaxandr opened this issue Jul 1, 2022 · 6 comments
Closed

Benchmark for Compose #169

maxmaxandr opened this issue Jul 1, 2022 · 6 comments
Assignees

Comments

@maxmaxandr
Copy link

How to implement microbenchmark test for compose function?

@keyboardsurfer
Copy link
Member

Passing this over to @bentrengrove. AFAICT we don't have a specific microbenchmark with Compose somewhere in our repo at the moment. I'd be up for having it in here though.

@bentrengrove
Copy link
Member

Sorry for the delay here, we are working to make a sample available. I will leave this bug open.

@JanMalch
Copy link

JanMalch commented Feb 9, 2024

@bentrengrove Is there an update for this or should one just use Macrobenchmarks?
Specifically, I'm curious about the CPU / memory consumption of Canvas + ImageVector vs Canvas + ImageBitmap.

@bentrengrove
Copy link
Member

There are issues we are working on that make the results from Microbenchmark used with Compose unstable and thus not really reliable, mainly around how long it takes to stabilise the JIT compilation. Once those are resolved we will make a sample for microbenchmark and Compose.

You could use Macrobenchmark for your question with a memory metric. It can be hard to differentiate from the noise but one technique is to just test a large number of the composable at the same time. So you could compose 50 Canvas + ImageVector composables and compare that to 50 Canvas + ImageBitmap composables. This should hopefully override any noise coming from the unrelated parts of the code that would be pulled into a macrobenchmark

@yschimke
Copy link
Contributor

@bentrengrove
Copy link
Member

That's what we are working on. The AndroidX version uses a lot of internal APIs, no commitment but its our goal to bring this feature set to everyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants