为了对比u540和u740运行java的性能
1.硬件对比
U540 | U740 | |
Processor |
·RV64GC (RV64IMAFDC) ·32KB I-Cache / 32KB D-Cache per core
·RV64IMAC ·16KB I-Cache / 8KB DTIM |
·RV64GC (RV64IMAFDC) ·32KB I-Cache / 32KB D-Cache per core
·RV64IMAC ·16KB I-Cache / 8KB DTIM |
内存 | 8GB DDR4 @2400 MT/s | 16GB DDR4 @ 1866 MT/s |
2. 软件环境
U540和U740系统均使用ubuntu官网下载的20.04版本替换5.11内核的方案,树莓派3B使用ubuntu官网下载的20.04版本。
操作系统:Ubuntu-20.04.3
内核版本:Linux-5.11.0-1017-generic
openjdk对riscv的支持是由华为、阿里等公司移植完成的,代码位于:
https://github.com/openjdk/jdk-sandbox/tree/riscv-port-branch
目前已经比较完善,未来有可能合并到openjdk的主分支。相关介绍参见以下链接:
Call for Discussion: New Project: RISC-V Port
java版本信息:
$ java --version
openjdk 18-testing 2022-03-15
OpenJDK Runtime Environment (build 18-testing+0-builds.shipilev.net-openjdk-jdk-riscv-b6-20211027)
OpenJDK 64-Bit Server VM (build 18-testing+0-builds.shipilev.net-openjdk-jdk-riscv-b6-20211027, mixed mode)
3.Benchmark测试程序
采用JMH (Java Microbenchmark Harness) ,地址:https://github.com/openjdk/jmh ,JMH是openjdk开发的用于程序性能测试的开发框架,主要基于方法层面的基准测试,精度可以达到纳秒级。
测试过程:
$ mvn archetype:generate \
-DinteractiveMode=false \
-DarchetypeGroupId=org.openjdk.jmh \
-DarchetypeArtifactId=jmh-java-benchmark-archetype \
-DgroupId=org.sample \
-DartifactId=test \
-Dversion=1.0
$ cd test/
$ mvn clean verify
$ java -jar target/benchmarks.jar
4.测试结果对比与总结
1. u540与u740对比
从结果来看,u740的运行性能约为u540的1.064倍。
表2 u540与u740结果对比
u540 | u740 | 对比 |
124343504.488 | 132354209.606 | 1 :1.064 |
2. u740与树莓派3b对比
从结果来看,树莓派3b的运行性能约为u740的1.49倍。
表3 u740与莓派3b结果对比
u740 | rasp3b | 对比 |
132354209.606 | 197468423.054 | 1 :1.49 |