oralodabas / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

Bad JS performance in Chromecast for ASMJS code #399

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Take a FAST AES implementation
2.Compile it with Emscripten into ASMJS
3.Include the script and call it in the receiver app

What is the expected output? What do you see instead?
On my Windows laptop the code decrypts 1M in 30ms, on Nexus 10 Android tablet - 
in 100ms. On Chromecast it takes ~26 seconds.

What version of the product are you using? On what operating system?
Chromecast firmware 19084

Please provide any additional information below.
I ran into this issue because I had to run some crypt code in my receiver, 
which I can't run from webcrypto. While I understand that it is not fare to 
compare the computational power of Nexus tablet with the chromecast, the 1000 
times slowness tells me that something is wrong with the JIt engine of Chromium 
used on Chromecast. Running AES from webcrypto on the same 1M of data runs 
~10ms which is really fast. I would like to know if this is indeed a JIT issues 
or some changes can be done to ASMJS to run faster.

Original issue reported on code.google.com by moshe.kr...@gmail.com on 6 Oct 2014 at 9:58

GoogleCodeExporter commented 9 years ago
Could you give more information on your cryptography implementation? A simple 
AES encryption test from our side revealed that the performance difference 
between the Chromecast and Nexus 7 is not as great as what you have mentioned. 
Also, on what device did you run the WebCrypto test that yielded 10ms? What was 
the WebCrypto performance on other devices?

Original comment by christia...@google.com on 30 Dec 2014 at 1:25

GoogleCodeExporter commented 9 years ago
Hi, I used fast AES implementation - similar to the openssl one 
https://github.com/openssl/openssl/blob/master/crypto/aes/aes_core.c

Just to make sure it is not missed - I took this C code and converted it to JS 
using ASMJS. It is this ASMJS code performance I'm complaining about.

10ms was the time I got on the Chromecast (well' it has a hardware AES)
As I wrote, I used Nexus 10, not Nexus 7. 

Original comment by moshe.kr...@gmail.com on 30 Dec 2014 at 9:18

GoogleCodeExporter commented 9 years ago
There are too many factors involved, including 3rd party libraries, to pinpoint 
the Chromium engine as the culprit. Please re-examine your AES implementation.

Original comment by christia...@google.com on 20 Jan 2015 at 11:12