Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a AVR Emulator (AVR8js) (benchmark ?!?!) #511

Open
ricardojlrufino opened this issue Jun 7, 2020 · 1 comment
Open

Running a AVR Emulator (AVR8js) (benchmark ?!?!) #511

ricardojlrufino opened this issue Jun 7, 2020 · 1 comment

Comments

@ricardojlrufino
Copy link

ricardojlrufino commented Jun 7, 2020

Hi doing some experiments running a emulator (AVR8js) in javascript interpreters, I found some substantial differences in performance, mainly in reporting the performance of the browser (chrome), running natively in nodejs the difference is even greater...

I'll share the results here, more information is here:
wokwi/avr8js#49 (comment)

simple benckmark
https://github.com/ricardojlrufino/avr8js_demo_node/tree/vanilla

@ricardojlrufino
Copy link
Author

ricardojlrufino commented Jun 7, 2020

Enviroment:
Ubuntu 18.04, Intel i7-4500, 16GB ram

J2V8 (attached code / avr8js_demo_vanilla/run-v8.js):

Program running...
Time: Blink finished in 0 ms
Time: Blink finished in 699 ms
Time: Blink finished in 613 ms
Time: Blink finished in 646 ms
Time: Blink finished in 620 ms
Time: Blink finished in 611 ms
Time: Blink finished in 604 ms
Time: Blink finished in 604 ms
Time: Blink finished in 631 ms
Time: Blink finished in 622 ms
Time: Blink finished in 604 ms

NodeJS: v13.12.0

node run.js

Time: Blink finished in 1 ms
Time: Blink finished in 162 ms
Time: Blink finished in 113 ms
Time: Blink finished in 114 ms
Time: Blink finished in 118 ms
Time: Blink finished in 112 ms
Time: Blink finished in 111 ms
Time: Blink finished in 132 ms
Time: Blink finished in 110 ms
Time: Blink finished in 114 ms
Time: Blink finished in 116 ms
Time: Blink finished in 112 ms
Time: Blink finished in 112 ms

graalvm

/opt/graalvm-ce-java8-20.1.0/bin/node run.js

Program running...
Time: Blink finished in 1 ms
Time: Blink finished in 2353 ms
Time: Blink finished in 2190 ms
Time: Blink finished in 783 ms
Time: Blink finished in 767 ms
Time: Blink finished in 802 ms
Time: Blink finished in 848 ms
Time: Blink finished in 803 ms
Time: Blink finished in 759 ms
Time: Blink finished in 825 ms
Time: Blink finished in 755 ms
Time: Blink finished in 804 ms
Time: Blink finished in 788 ms
Time: Blink finished in 778 ms


Running on: browser

bundle.js:2522 Fetch finished loading: GET "http://localhost:3000/blink.hex".
bundle.js:2560 Program running...
bundle.js:2605 Time: Blink finished in 0 ms
bundle.js:2605 Time: Blink finished in 244 ms
bundle.js:2605 Time: Blink finished in 183 ms
bundle.js:2605 Time: Blink finished in 224 ms
bundle.js:2605 Time: Blink finished in 170 ms
bundle.js:2605 Time: Blink finished in 168 ms
bundle.js:2605 Time: Blink finished in 166 ms
bundle.js:2605 Time: Blink finished in 172 ms
bundle.js:2605 Time: Blink finished in 167 ms
bundle.js:2605 Time: Blink finished in 192 ms
bundle.js:2605 Time: Blink finished in 164 ms
bundle.js:2605 Time: Blink finished in 170 ms
bundle.js:2605 Time: Blink finished in 167 ms
bundle.js:2605 Time: Blink finished in 166 ms
bundle.js:2605 Time: Blink finished in 177 ms
bundle.js:2605 Time: Blink finished in 166 ms
bundle.js:2605 Time: Blink finished in 165 ms
bundle.js:2605 Time: Blink finished in 169 ms
bundle.js:2605 Time: Blink finished in 164 ms
bundle.js:2605 Time: Blink finished in 165 ms
bundle.js:2605 Time: Blink finished in 179 ms
bundle.js:2605 Time: Blink finished in 175 ms
bundle.js:2605 Time: Blink finished in 164 ms
bundle.js:2605 Time: Blink finished in 178 ms

package javascript.j2v8;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import com.eclipsesource.v8.NodeJS;
import com.eclipsesource.v8.V8;

public class J2V8 {
  public static void main(String[] args) throws IOException {
    
    Path path = Paths.get("/media/ricardo/Dados/TEMP/testes-java/avr8js_demo_vanilla/run-v8.js");

    NodeJS node = NodeJS.createNodeJS();
    node.exec(path.toFile());

    while (node.isRunning()) {
      node.handleMessage();
    }
  }
}

PS: J2V8 need remove async / await .. only..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant