-
Notifications
You must be signed in to change notification settings - Fork 196
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
AVR8js High Memory and Slow... (benchmark ?!?!) #296
Comments
I converted the scripts to pure javascript -- using cmd line -- using java package javascript.avr;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.HostAccess;
public class HelloPolyglot {
/**
* A GraalVM engine shared between multiple JavaScript contexts.
*/
private static final Engine sharedEngine = Engine.newBuilder().build();
public static void main(String[] args) throws IOException, URISyntaxException {
System.out.println("Hello Java!");
// try (Context context = Context.create()) {
try (Context context = Context.newBuilder()
.allowExperimentalOptions(true)
.allowHostAccess(HostAccess.ALL)
.allowAllAccess(true)
.allowHostClassLoading(true)
.allowNativeAccess(true)
.allowIO(true)
.engine(sharedEngine)
// .option("js.nashorn-compat", "true")
.option("js.v8-compat", "true")
.build()) {
byte[] allBytes = Files.readAllBytes(Paths.get("/media/ricardo/Dados/TEMP/testes-java/avr8js_demo_vanilla/bundle.js"));
context.eval("js", new String(allBytes)).putMember("fromJava", "true");
}
}
} it's running on the browser a little faster |
thanks for your report. Can you please clarify what exactly you run, and what the output means: I can run Regarding your initial example Ideal would be a commandline where I can 1:1 compare Graal.js and original Node.js. (so any commandline that works on original Node should work for us as well). Thanks, |
Another finding: |
i'm improve the report, please see: check this branche:
now have a more clear and comparable output...
/opt/graalvm-ce-java8-20.1.0/bin/node run.js |
this code uses AVR8js, an Arduino processor simulator It is running the following code (blink.hex) void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT); // PIN 12
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("V1");
delay(100);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("V0");
delay(100);
} |
Any ideia ? because the performance in the nodejs (from graalVM ) version will be different from the standard version ? |
Hi, i am trying on your
Still get the same output of
Fails with
Fails with Something is wrong with those commandlines, I don't think that's exactly how you ran them? After looking into your run.js: you have different codepaths for different engines, which is not great for a benchmark to have. And why DO you have a special path for Graal.js here at all? Graal.js is Node.js compatible, there is no necessity to detect the Fixing that and trying again, I get: with original Node.js 12.16.3: with GraalVM EE 20.1.0 in native mode with GraalVM EE 20.1.0 in jvm mode
Of course it will! In this mode, you are executing Node.js with a different JavaScript engine (GraalVM JavaScript instead of V8). This will of course show different performance characteristics. We are working on getting our peak performance as good as V8 - on some benchmarks, we can significantly outperform them, on many benchmarks we are still a bit slower. Like on this one, where Node.js/V8 is ~2x faster. |
I was making the modifications and testing to understand how everything worked ... until then, I had not understood the differences from one to the other. Your results seem to be better, if something related to 'EE' version ?!
Great to know man. I think I will follow an alternative to using a version of the AVR emulator in C |
Hi, I recently found an interesting project to emulate the AVR (Arduino) chip made entirely in javascript.
I thought it would be a way to be able to use and integrate with a java application.
However in the first tests with graaljs, I saw that I had a very high consumption of CPU and Memory, and slow:
Using: Ubuntu 18.04, Intel i7-4500, 16GB ram
Native:
Test:
https://github.com/ricardojlrufino/avr8js_demo_node
I found the difference in performance strange...
I think it can be an interesting benchmark for the graalVM
The text was updated successfully, but these errors were encountered: