-1
$\begingroup$

I am running a simple AES encryption operation both on desktop(using core i7 processor, 16GB Ram, eclipse and JDK8) and mobile(Android emulator using Intel atom X84 processor 2 GB ram, Android 6.0). I am surprised with the result when mobile emulator took significantly less time than desktop for encryption operation with same amount of data and same key. Could anybody explain why it is happening?

| improve this question | | | | |
$\endgroup$
  • $\begingroup$ I've downvoted as you've provided nothing that defines the tests that you are running. Happy to change my vote if you clearly specify the tests, running environment and of course results. $\endgroup$ – Maarten Bodewes Jul 31 '17 at 23:28
3
$\begingroup$

Be adviced benchmarking (and micro-bechmarking) is a very tricky domain.

You need to consider startup, warmup, I/O time.. So there are a lot of factors involved you haven't stated. AES encryption itself is serial operation so it all comes down to CPU speed or HW support of AES operations. My guess would be the emulator app and data are loaded in RAM, while on the desktop you have to read it from the disk.

AES has even very nice property (if someone recalls the name, please comment) the implementation could use relatively small amount of memory for limited devices or for more powerful platforms the shift and mix operations can be translated to lookup tables so the operation is faster but it requires more RAM and the preparation time (warmup) may be longer. (I am not sure what is used in the Android libraries)

So - summing up - to get better answer you'd have to provide more information and prepare the benchmarking well.

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ The warmup time of the AES algorithm itself should be insignificant unless the AES algorithm is re-initialized for each and every small encryption routine. $\endgroup$ – Maarten Bodewes Jul 31 '17 at 23:26
0
$\begingroup$

The disparity is just between the implementations. If you have a Java method, and an emulator that used the hardware AES blocks, you should see only a difference based on CPU speed because in both cases, completion takes 14 cycles. The overview of AES-NI will get you more information.

It's just probably a function of how the JVM is implemented combined with the classes, but from a hardware perspective, it should basically be the same.

| improve this answer | | | | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.