Status Update
Comments
an...@google.com <an...@google.com>
an...@steadfastinnovation.com <an...@steadfastinnovation.com> #2
Hmm
I can repro on API 33 but not on API 34
di...@google.com <di...@google.com> #3
Can't repro with API 24 as well.
an...@google.com <an...@google.com> #4
Can't repro with 21 or 32. Looks like issue is specific to API 33.
[Deleted User] <[Deleted User]> #5
And seems to have nothing to do with ByteBuffer.
fun testCpu() {
val random = Random(Date().time)
val nanoTime = measureNanoTime {
repeat(100_000) {
sin(random.nextDouble())
}
}
Log.d("SinTest", "100_000 * sin() loop took ${TimeUnit.NANOSECONDS.toMillis(nanoTime)}ms")
}
Results in:
2023-08-02 11:32:07.506 9391-9391 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 9ms
2023-08-02 11:32:08.417 9391-9391 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 2ms
2023-08-02 11:32:09.296 9391-9391 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 1ms
2023-08-02 11:32:09.992 9391-9391 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 1ms
2023-08-02 11:32:10.720 9391-9391 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 1ms
---------------------------- PROCESS ENDED (9391) for package com.alonalbert.myapplication ----------------------------
---------------------------- PROCESS STARTED (9463) for package com.alonalbert.myapplication ----------------------------
2023-08-02 11:32:27.663 9463-9463 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 78ms
2023-08-02 11:32:28.537 9463-9463 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 105ms
2023-08-02 11:32:29.262 9463-9463 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 103ms
2023-08-02 11:32:29.887 9463-9463 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 104ms
2023-08-02 11:32:30.663 9463-9463 SinTest com.alonalbert.myapplication D 100_000 * sin() loop took 104ms
am...@google.com <am...@google.com> #6
I can reproduce without Android Studio in the loop at all.
Do the following on an API 33 device or emulator, then on any other API level.
$ adb install -r slow-under-debugger.apk
$ # Start the app and observe
$ adb jdwp
14051
^C
$ adb forward tcp:5005 jdwp:14051
$ jdb -attach hostname=localhost,port=5005
$ Observe the app
On a API 33 device, the execution time jumps by a factor of about 50 when it's attached to the debugger.Note that when the debugger is detached, it returns to normal.
an...@steadfastinnovation.com <an...@steadfastinnovation.com> #7
Thanks Alon! I will take a look. There are several improvements which went into Android 34 around breakpoints. Though I am not aware of any particular regression in Android 33 when compared to Android 32.
an...@steadfastinnovation.com <an...@steadfastinnovation.com> #8
Actually, we had to cherrypick a fix to Android T to address slowness when debugger is attached:
I think any T release should have that fix included. So not sure if it's the same issue. I am trying to reproduce this locally.
From the initial description looks like it is also an issue with API 32?
Reproducible on Google Pixel 3a XL API 32 and API 33 x86_64 emulator.
am...@google.com <am...@google.com> #9
I can reproduce this on API 33 emulator but not on API 32 similar to what Alon observed. The extent of slowdown seems to suggest we are using the slow interpreter which was fixed by the CL I mentioned in c#8. I think the emulator image should include that CL. I am trying to verify that.
Version of the emulator:
Linux version 5.15.41-android13-8-00055-g4f5025129fe8-ab8949913 (build-user@build-host) (Android (8508608, based on r450784e) clang version 14.0.7 (
Description
I've created a module in an app that is only intended for Compose UI components.
This module includes the following dependencies:
When trying to use the Preview functionality in Android Studio it cannot render anything. For example:
The following stacktrace occurs on all previews:
As a workaround adding
androidx.activity:activity-ktx:1.2.3
as a dependency makes the Preview functionality work again.Let me know if you need me to create a sample project.