translated

This commit is contained in:
geekpi 2017-10-16 10:05:32 +08:00
parent d237d92784
commit 9fc10bf789
2 changed files with 140 additions and 141 deletions

View File

@ -1,141 +0,0 @@
translating---geekpi
Genymotion vs Android Emulator
============================================================
### Has the Android emulator improved enough to take on Genymotion
There has always been a debate about which android emulator to choose or to go with Genymotion, Ive seen most of the discussion ending in favor of Genymotion.
Ive gathered some data around the most common use case according to me, based on this Ill be evaluating all the android emulators along with Genymotion.
TL;DR: Android emulator is faster than Genymotion when configured right.
Use x86 (32 bit) image with Google APIs, 3GB ram, quad-core CPU.
> Pheww, glad were past that
> Now, lets dive deep
Disclaimer: Ive tested my use case which to me looks the general use case i.e. running tests. All benchmarks were done on a mid-2015 MacBook Pro.
Wherever I say Genymotion I mean Genymotion Desktop. They have other products like Genymotion on Cloud & Genymotion on Demand which are not being considered here.
Im not saying Genymotion is inadequate but is slower when running tests compared to certain Android emulators.
A little background on the subject and then well jump to the good stuff.
_Psst: I have some benchmarks down the line, stick around._
Long ago Android emulator was the only way to go. But they were too slow to use, the reason being a change of architecture.
What can you expect out of an ARM emulator running on an x86 machine? Every instruction had to be converted from ARM to x86 architecture which makes it really slow.
Then came along the x86 images of Android which are way faster as they get rid of the ARM to x86 platform change.
Now you can run x86 Android emulator on an x86 machine.
> _Problem solved!!!_
>
> NO!
Android emulators were still slow from what people wanted.
Then came along Genymotion, which is just an Android VM running in a virtual box. But it is quite stable & fast compared to plain old android emulators which run on qemu.
Lets jump to how the situation is today.
My team is using Genymotion in CI infrastructure and on developer machines. The task at hand was to get rid of all the Genymotion used in our CI infrastructure and developer machines.
> You ask why?
> Licenses cost money. Duh…
At a quick glance it seems like a stupid move as Android emulators are slow and buggy, they seem counterproductive, but when you get into the nitty-gritty of the situation youll actually find Android emulator to be superior.
Our use case is to run integration tests on them (mostly espresso).
We have just over 1100 tests in our app and Genymotion takes ~23 minutes to run all the tests.
A few other problems we were facing with Genymotion.
* Limited command line tools ([GMTool][1]).
* They needed periodic restart because of memory issues. This was a manual task, imagine doing it on a CI infrastructure with lots of machines.
Enter Android Emulator
The first time you try to set-up one of these it gives you so many options that youll feel like you are in Subway restaurant.
The biggest question of all is x86 or x86_64 and with Google APIs or without them.
I did some research and benchmarking with these combinations and this is what we came up with.
Drum Roll…
> The winner of the competition is x86 with Google APIs
> But how? why?
Well, Ill tell you the problem with every one of them.
x86_64 is slower compared to x86
> By how much you ask.
>
> 28.2% much !!!
Emulator with Google APIs is more stable, things tend to crash without them.
This brings us to the conclusion that the best one is x86 with Google APIs.
Before we pit our winning emulator against Genymotion. There are few more details that are of great importance.
* Ive used Nexus 5 system image with Google APIs.
* I noticed that giving emulator less ram caused a lot of Google API crashes. So Ive settled for 3GB of ram for an emulator.
* The emulator has a quad-core.
* HAXM was installed on the host machine.
Time for few benchmark
![Genymotion and Android Emulator Espresso Benchmark](https://d33wubrfki0l68.cloudfront.net/5ffb16e99dbccd5f6e4848d7a1b6b92646fea15f/1356a/assets/images/genymotion-vs-android-emulator/espressobenchmark.png)
![Linpack](https://d33wubrfki0l68.cloudfront.net/e5c28d737abf8dee69333f83657928c362157b4e/ede85/assets/images/genymotion-vs-android-emulator/linpack.png)
![Geekbench 4](https://d33wubrfki0l68.cloudfront.net/b5af78db6d6eddd090d601fcf32c11e7622759f0/b00c1/assets/images/genymotion-vs-android-emulator/geekbench4.png)
From the benchmarks, you can see that Android emulator beats Genymotion expect for in Geekbench4 which to me feels more of a virtual box beating qemu thing.
> All hail the King of the Emulators
We are now having a faster test execution time, better command line tools. Also with the latest [Android Emulator][2], things have gone a notch up. Faster boot time and what not.
Google has been working very hard to
> Make Android Emulator great again
If you havent been using android emulator from some time. Id suggest you revisit and save some money.
One other solution which I was trying but couldnt really get it to work was running an [Android-x86][3] image on AWS.
I was able to run it on a vSphere ESXi Hypervisor but not on AWS or any other cloud platform. If someone knows anything about it do comment below.
PS: [VMWare is now available on AWS][4], [Android-x86][5] on AWS might be possible after all.
--------------------------------------------------------------------------------
作者简介:
Hi, My name is Sumit Gupta. Im a software/application/web developer, from Gurgaon, India.
Im in this business because I love technology and it never fails to fascinate me. Ive been working for more than 3 years, in this time Ive had many learning though this time. Dont they say If you have knowledge, let others light their candles in it.
When its compiling, I read articles, lots of them or listening to music.
Below are my social feeds & [email][6] if you want to reach me.
via: https://www.plightofbyte.com/android/2017/09/03/genymotion-vs-android-emulator/
作者:[Sumit Gupta ][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.plightofbyte.com/about-me
[1]:https://docs.genymotion.com/Content/04_Tools/GMTool/GMTool.htm
[2]:https://developer.android.com/studio/releases/emulator.html
[3]:http://www.android-x86.org/
[4]:https://aws.amazon.com/vmware/
[5]:http://www.android-x86.org/
[6]:thesumitgupta@outlook.com

View File

@ -0,0 +1,140 @@
Genymotion vs Android 模拟器
============================================================
### Android 模拟器是否有足够的改善来取代 Genymotion
一直以来一直有关于选择 android 模拟器或者 Genymotion 的争论,我看到很多讨论最后赞成 Genymotion。
我根据我周围最常见的情况收集了一些数据, 基于此, 我将连同 Genymotion 评估所有的 android 模拟器。
最后结论配置正确时Android 模拟器比 Genymotion 快。
使用带 Google API 的 x8632位镜像、3GB RAM、四核CPU。
> 哈,很高兴我们跳过了
> 现在,让我们深入
免责声明:我已经测试了我的看到的一般情况,即运行测试。所有的基准测试都是在 2015 年中期的 MacBook Pro 上完成的。
无论何时我说 Genymotion 指的都是 Genymotion Desktop。他们还有其他产品如 Genymotion on CloudGenymotion on Demand这里没有考虑。
我不是说 Genymotion 是不合适的,但运行测试比某些 Android 模拟器慢。
关于这个问题的一点背景,然后我们将跳到好的东西上。
_过去我有一些基准测试继续下去。_
很久以前Android 模拟器是唯一的选择。但是它们太慢了,这是架构改变的原因。
在 x86 机器上运行的 ARM 模拟器可以期待什么?每个指令都必须从 ARM 转换为 x86 架构,这使得它的速度非常慢。
随之而来的是 Android 的 x86 镜像,随着它们摆脱了 ARM 到 x86 平台转化,速度更快了。
现在,你可以在 x86 机器上运行 x86 Android 模拟器。
> _问题解决了_
>
> 没有!
Android 模拟器仍然比人们想要的慢。
随后出现了 Genymotion这是一个在虚拟机中运行的 Android 虚拟机。但是,与在 qemu 上运行的普通老式 android 模拟器相比,它相当稳定和快速。
我们来看看今天的情况。
我的团队在 CI 基础架构和开发机器上使用 Genymotion。手头的任务是摆脱 CI 基础设施和开发机器中使用的所有 Genymotion。
> 你问为什么?
> 授权费钱。
在快速看了一下以后,这似乎是一个愚蠢的举动,因为 Android 模拟器的速度很慢而且有 bug但它们看起来适得其反但是当你深入的时候你会发现 Android 模拟器是优越的。
我们的情况是对它们进行集成测试(主要是 espresso
我们的应用程序中只有 1100 多个测试Genymotion 需要大约 23 分钟才能运行所有测试。
在 Genymotion 中我们面临的另一些问题是:
* 有限的命令行工具([GMTool][1])。
* 由于内存问题,它们需要定期重新启动。这是一个手动任务,想象在配有许多机器的 CI 基础设施上进行这些会怎样。
进入 Android 模拟器
第一次尝试设置其中的一个,它给你这么多的选择,你会觉得你在 Subway 餐厅。
最大的问题是 x86 或 x86_64 以及是否有 Google API。
我用这些组合做了一些研究和基准测试,这是我们想出来的。
鼓声。。。
> 比赛的获胜者是带 Google API 的 x86
> 但是如何?为什么?
嗯,我会告诉你每一个的问题。
x86_64 比 x86 慢
> 你问慢多少.
>
> 28.2% 多!!!
使用 Google API 的模拟器更加稳定,没有它们容易崩溃。
这使我们得出结论:最好的是带 Google API 的x86。
在我们抛弃 Genymotion 开始使用模拟器之前。有下面几点重要的细节。
* 我使用的是带 Google API 的 Nexus 5 镜像。
* 我注意到,给模拟器较少的 RAM 会造成了很多 Google API 崩溃。所以为模拟器设定了 3GB 的 RAM
* 模拟器有四核
* HAXM 安装在主机上。
基准测试的时候到了
![Genymotion and Android Emulator Espresso Benchmark](https://d33wubrfki0l68.cloudfront.net/5ffb16e99dbccd5f6e4848d7a1b6b92646fea15f/1356a/assets/images/genymotion-vs-android-emulator/espressobenchmark.png)
![Linpack](https://d33wubrfki0l68.cloudfront.net/e5c28d737abf8dee69333f83657928c362157b4e/ede85/assets/images/genymotion-vs-android-emulator/linpack.png)
![Geekbench 4](https://d33wubrfki0l68.cloudfront.net/b5af78db6d6eddd090d601fcf32c11e7622759f0/b00c1/assets/images/genymotion-vs-android-emulator/geekbench4.png)
从基准测试上你可以看到除了 Geekbench4Android 模拟器都击败了 GenymotionGeekbench4 我感觉更像是虚拟机击败 qemu。
> 欢呼模拟器之王
We are now having a faster test execution time, better command line tools. Also with the latest [Android Emulator][2], things have gone a notch up. Faster boot time and what not.
我们现在有更快的测试执行时间、更好的命令行工具。最新的 [Android Emulator][2] 创下的新的记录。更快的启动时间之类。
Goolgle 一直努力让
> Android Emulator 变得更好
如果你没有在使用 android 模拟器。我建议你重新试下来节省一些钱。
我尝试的另一个但是没有成功的方案是在 AWS 上运行 [Android-x86][3] 镜像。
我能够在 vSphere ESXi Hypervisor 中运行它,但不能在 AWS 或任何其他云平台上运行它。如果有人知道原因,请在下面评论。
PS[VMWare 现在可以在 AWS 上使用][4],在 AWS 上使用 [Android-x86][5] 毕竟是有可能的。
--------------------------------------------------------------------------------
作者简介:
嗨,我的名字是 Sumit Gupta。我是来自印度古尔冈的软件/应用/网页开发人员。
我做这个是因为我喜欢技术,并且一直迷恋它。我已经工作了 3 年以上,但我还是有很多要学习。他们不是说如果你有只是,让别人点亮他们的蜡烛。
当在编译时,我阅读很多文章,或者听音乐。
如果你想联系,下面是我的社交信息和 [email][6]。
via: https://www.plightofbyte.com/android/2017/09/03/genymotion-vs-android-emulator/
作者:[Sumit Gupta ][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.plightofbyte.com/about-me
[1]:https://docs.genymotion.com/Content/04_Tools/GMTool/GMTool.htm
[2]:https://developer.android.com/studio/releases/emulator.html
[3]:http://www.android-x86.org/
[4]:https://aws.amazon.com/vmware/
[5]:http://www.android-x86.org/
[6]:thesumitgupta@outlook.com