Android Studio-仿真器配置文件和设备配置文件非常不同 [英] Android Studio - Emulator Profile and Device Profile VERY different
问题描述
我在问一个不同的问题时遇到了这个问题,为什么Android Emulator与可比较的设备配置文件相比会表现出如此不同的性能配置文件?
I came across this while asking a different question, why does the Android Emulator show such a different performance profile than a comparable device profile?
具体来说,设备会调用一个巨大的图形部分,而该部分在模拟器上不可见...这是有原因的吗?
Specifically, the device calls a huge graphics section that is not visible on the emulator... is there a reason for this?
设备-26api-48Mb
Device - 26api - 48Mb
仿真器(Pixel2)-26api-24Mb-硬件图形
Emulator (Pixel2) - 26api - 24Mb - Hardware Graphics
仿真器(Pixel2)-26api-54Mb-软件图形
Emulator (Pixel2) - 26api - 54Mb - Software Graphics
设备-24api-52Mb
Device - 24api - 52Mb
仿真器(Pixel2)-24api-硬件图形-15Mb
Emulator (Pixel2) - 24api - Hardware Graphics - 15Mb
仿真器(Pixel2)-24api-软件图形-40Mb
Emulator (Pixel2) - 24api - Software Graphics - 40Mb
设备-22Api-50Mb
Device - 22Api - 50Mb
仿真器(Pixel2)-22api-硬件图形-14Mb
Emulator (Pixel2) - 22api - Hardware Graphics - 14Mb
仿真器(Pixel2)-22api-软件图形-40Mb
Emulator (Pixel2) - 22api - Software Graphics - 40Mb
推荐答案
这取决于您如何大量配置RAM
和HAXM
来配置Emulator
.
This depend on how your configure Emulator
if you a good amount of RAM
with HAXM
.
如果Emulator
RAM
大于Device
,则可以减少应用程序System.gc()
的性能.
This can improve your performance app have less System.gc()
if Emulator
RAM
is more than Device
.
But is not the only things and you can configure your HAXM
acceleration HAXM acceleration Doc.
说明
Without acceleration, the emulator takes the machine code from the VM and translates it block by block to conform to the architecture of the host computer. This process can be quite slow. But, if the VM and the architecture of the host computer match (such as x86 on x86), the emulator can skip translating the code and simply run it directly on the actual CPU using a hypervisor. In this case, the emulator can approach the speed of the host computer.
说明2
When you create an Android Virtual Device (AVD) in the AVD Manager, you can specify that graphics acceleration occur in hardware or software to emulate the GPU of the virtual device. Hardware acceleration is typically faster. Software acceleration is useful if your computer uses graphics drivers that aren't compatible with the emulator, in which case hardware graphics rendering can be poor or cause the emulator to crash.
The default is to let the emulator decide if it should use hardware or software graphics acceleration based on your computer setup. If the GPU hardware and drivers are compatible, the emulator uses the GPU; otherwise, the emulator uses the CPU to simulate GPU processing.
Graphics: Memory used for graphics buffer queues to display pixels to the screen, including GL surfaces, GL textures, and so on. (Note that this is memory shared with the CPU, not dedicated GPU memory.)
使用Memory Profiler Doc查看Java堆和内存分配
View the Java heap and memory allocations with Memory Profiler Doc
为什么您的Graphic use
属于0Mb
是因为Memory Profiler
计算了CPU
和GPU
之间共享的内存,而不专用于GPU
.
So why your Graphic use
is to 0Mb
is because the Memory Profiler
calculating the memory shared between CPU
and GPU
not dedicated to GPU
.
0Mb也是如此,因为您使用的是hardware
,而不是software to emulate the GPU
.
So is 0Mb because you use hardware
I think instead of software to emulate the GPU
.
这篇关于Android Studio-仿真器配置文件和设备配置文件非常不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!