Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ada5a3f

Browse filesBrowse files
committed
Merge branch 'release/v0.1.0'
2 parents 37e6922 + 50de72c commit ada5a3f
Copy full SHA for ada5a3f
Expand file treeCollapse file tree

18 files changed

+2563
-22
lines changed

‎.gitignore

Copy file name to clipboard
+4-21Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
# Compiled class file
2-
*.class
1+
.gradle
2+
.idea
3+
build
4+
*.iml
35

4-
# Log file
5-
*.log
6-
7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.ear
17-
*.zip
18-
*.tar.gz
19-
*.rar
20-
21-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22-
hs_err_pid*

‎README.md

Copy file name to clipboard
+130-1Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,131 @@
11
# jvm-benchmark
2-
A JVM benchmark
2+
3+
A JVM benchmark for EV3.
4+
5+
In a EV3 Brick managed with EV3Dev, it is possible to install some [JVM](https://wiki.debian.org/Java/):
6+
7+
- [Oracle Java 8 SE Embedded](http://www.oracle.com/technetwork/java/embedded/downloads/javase/javaseemeddedev3-1982511.html)
8+
- [OpenJDK 8 Headless](https://packages.debian.org/jessie-backports/openjdk-8-jdk-headless)
9+
10+
If you have a Brick with both JRE (Oracle & OpenJDK), this project could
11+
help you to know what JVM has better performance.
12+
13+
## The benchmark script:
14+
15+
```
16+
#!/bin/bash
17+
18+
start=`date +%s`
19+
/usr/lib/jvm/java-8-openjdk-armel/jre/bin/java -server -jar jvm-benchmark-all-0.1.0-SNAPSHOT.jar
20+
end=`date +%s`
21+
22+
runtime=$((end-start))
23+
echo $runtime
24+
25+
start=`date +%s`
26+
/opt/ejdk1.8.0/linux_arm_sflt/jre/bin/java -server -jar jvm-benchmark-all-0.1.0-SNAPSHOT.jar
27+
end=`date +%s`
28+
29+
runtime=$((end-start))
30+
echo $runtime
31+
```
32+
33+
## The results:
34+
35+
```
36+
robot@ev3dev:~$ ./benchmark.sh
37+
38+
GeneralBench 1.2
39+
6 byte[16384] manual copies: 182 ms 540131 bytes/sec
40+
1220 byte[16384] arraycopies: 360 ms 55523555 bytes/sec
41+
24 int[4096] manual copies: 200 ms 1966080 bytes/sec
42+
1220 int[4096] arraycopies: 361 ms 55369750 bytes/sec
43+
200000 byte add: 67 ms 2985074 ops/sec
44+
200000 byte sub: 60 ms 3333333 ops/sec
45+
200000 byte mul: 63 ms 3174603 ops/sec
46+
200000 byte div: 95 ms 2105263 ops/sec
47+
200000 short add: 102 ms 1960784 ops/sec
48+
200000 short sub: 91 ms 2197802 ops/sec
49+
200000 short mul: 79 ms 2531645 ops/sec
50+
200000 short div: 115 ms 1739130 ops/sec
51+
200000 char add: 68 ms 2941176 ops/sec
52+
200000 char sub: 89 ms 2247191 ops/sec
53+
200000 char mul: 77 ms 2597402 ops/sec
54+
200000 char div: 149 ms 1342281 ops/sec
55+
200000 int add: 69 ms 2898550 ops/sec
56+
200000 int sub: 74 ms 2702702 ops/sec
57+
200000 int mul: 86 ms 2325581 ops/sec
58+
200000 int div: 106 ms 1886792 ops/sec
59+
200000 long add: 77 ms 2597402 ops/sec
60+
200000 long sub: 83 ms 2409638 ops/sec
61+
200000 long mul: 102 ms 1960784 ops/sec
62+
200000 long div: 232 ms 862068 ops/sec
63+
200000 float add: 103 ms 1941747 ops/sec
64+
200000 float sub: 112 ms 1785714 ops/sec
65+
200000 float mul: 104 ms 1923076 ops/sec
66+
200000 float div: 175 ms 1142857 ops/sec
67+
200000 double add: 124 ms 1612903 ops/sec
68+
200000 double sub: 127 ms 1574803 ops/sec
69+
200000 double mul: 101 ms 1980198 ops/sec
70+
200000 double div: 527 ms 379506 ops/sec
71+
200000 method calls: 880 ms 227272 ops/sec
72+
200000 static method calls: 868 ms 230414 ops/sec
73+
2000 string concats: 2896 ms 690 ops/sec
74+
20000 string compares (easy): 605 ms 33057 ops/sec
75+
1000 string compares (hard): 22 ms 45454 ops/sec
76+
20000 object creations: 853 ms 23446 ops/sec
77+
6242048 Total Loop Executions: 21614 ms 288796 loops/sec
78+
Note: each Loop Execution includes multiple Java operations
79+
100
80+
81+
GeneralBench 1.2
82+
6 byte[16384] manual copies: 87 ms 1129931 bytes/sec
83+
1220 byte[16384] arraycopies: 162 ms 123385679 bytes/sec
84+
24 int[4096] manual copies: 111 ms 3542486 bytes/sec
85+
1220 int[4096] arraycopies: 144 ms 138808888 bytes/sec
86+
200000 byte add: 96 ms 2083333 ops/sec
87+
200000 byte sub: 9 ms 22222222 ops/sec
88+
200000 byte mul: 3 ms 66666666 ops/sec
89+
200000 byte div: 35 ms 5714285 ops/sec
90+
200000 short add: 116 ms 1724137 ops/sec
91+
200000 short sub: 2 ms 100000000 ops/sec
92+
200000 short mul: 1 ms 200000000 ops/sec
93+
200000 short div: 47 ms 4255319 ops/sec
94+
200000 char add: 119 ms 1680672 ops/sec
95+
200000 char sub: 2 ms 100000000 ops/sec
96+
200000 char mul: 2 ms 100000000 ops/sec
97+
200000 char div: 41 ms 4878048 ops/sec
98+
200000 int add: 105 ms 1904761 ops/sec
99+
200000 int sub: 2 ms 100000000 ops/sec
100+
200000 int mul: 1 ms 200000000 ops/sec
101+
200000 int div: 55 ms 3636363 ops/sec
102+
200000 long add: 108 ms 1851851 ops/sec
103+
200000 long sub: -1 ms -200000000 ops/sec
104+
200000 long mul: -2 ms -100000000 ops/sec
105+
200000 long div: 357 ms 560224 ops/sec
106+
200000 float add: 238 ms 840336 ops/sec
107+
200000 float sub: 1 ms 200000000 ops/sec
108+
200000 float mul: 1 ms 200000000 ops/sec
109+
200000 float div: 1 ms 200000000 ops/sec
110+
200000 double add: 315 ms 634920 ops/sec
111+
200000 double sub: 1 ms 200000000 ops/sec
112+
200000 double mul: 1 ms 200000000 ops/sec
113+
200000 double div: 1 ms 200000000 ops/sec
114+
200000 method calls: 85 ms 2352941 ops/sec
115+
200000 static method calls: 75 ms 2666666 ops/sec
116+
2000 string concats: 491 ms 4073 ops/sec
117+
20000 string compares (easy): 62 ms 322580 ops/sec
118+
1000 string compares (hard): 3 ms 333333 ops/sec
119+
20000 object creations: 135 ms 148148 ops/sec
120+
6242048 Total Loop Executions: 5200 ms 100393 loops/sec
121+
Note: each Loop Execution includes multiple Java operations
122+
11
123+
robot@ev3dev:~$
124+
```
125+
126+
## Conclussions:
127+
128+
After the review of the results, it is clear that it is better to use
129+
the Oracle JVM for EV3 Brick.
130+
131+
Juan Antonio

‎build.gradle

Copy file name to clipboard
+55Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//Gradle file library ev3dev-lang-java // jvm-benchmark
2+
//Author: Juan Antonio Breña Moral
3+
4+
version = '0.1.0'
5+
6+
apply plugin: 'java'
7+
apply plugin: 'eclipse'
8+
apply plugin: 'idea'
9+
10+
repositories {
11+
mavenCentral()
12+
maven { url "https://jitpack.io" }
13+
}
14+
15+
dependencies {
16+
17+
testCompile("junit:junit:4.12")
18+
testCompile("org.hamcrest:hamcrest-all:1.3")
19+
}
20+
21+
//Compile
22+
compileJava {
23+
sourceCompatibility = 1.8
24+
targetCompatibility = 1.8
25+
}
26+
27+
//Jar
28+
jar {
29+
baseName = "${rootProject.name}"
30+
}
31+
32+
//Fat Jar
33+
task fatJar(type: Jar) {
34+
baseName = "${rootProject.name}" + "-all"
35+
manifest {
36+
from file("${projectDir}/src/main/java/META-INF/MANIFEST.MF")
37+
}
38+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
39+
with jar
40+
}
41+
42+
//Deploy on Brick
43+
buildscript {
44+
repositories {
45+
maven {
46+
url "https://plugins.gradle.org/m2/"
47+
}
48+
}
49+
dependencies {
50+
classpath "org.hidetake:gradle-ssh-plugin:2.0.0"
51+
}
52+
}
53+
apply plugin: 'org.hidetake.ssh'
54+
55+
apply from: 'deploy.gradle'

‎deploy.gradle

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
remotes {
3+
ev3dev {
4+
host = '192.168.1.206'
5+
user = 'robot'
6+
password = 'maker'
7+
}
8+
}
9+
10+
task deploy << {
11+
ssh.run {
12+
session(remotes.ev3dev) {
13+
put from: "./build/libs/" + "${rootProject.name}" + "-all-" + version + ".jar", into: "/home/robot/"
14+
}
15+
}
16+
}
17+
deploy.dependsOn clean, fatJar
18+
19+
task remoteRun << {
20+
ssh.run {
21+
session(remotes.ev3dev) {
22+
println "java -server -jar /home/robot/" + "${rootProject.name}" + "-all-" + version + ".jar"
23+
execute "java -server -jar /home/robot/" + "${rootProject.name}" + "-all-" + version + ".jar"
24+
}
25+
}
26+
}
27+
28+
task deployAndRun << {
29+
30+
}
31+
deployAndRun.dependsOn deploy, remoteRun

‎gradle/wrapper/gradle-wrapper.jar

Copy file name to clipboard
51 KB
Binary file not shown.
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Tue May 16 22:30:42 BST 2017
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.