Git Product home page Git Product logo

m1-test's Introduction

目录

概述

本文列出了我在我的YouTube视频: M1性能测试里跑过的测试命令,用于比较我的M1 Macbook Ai和我的Intel Core i9 Macbook Pro的编译速度。

测试1和测试2使用的是JDK-x64, 在两台机器上都运行了。

测试3和测试4使用的是JDK-aarch64, 只在M1 Macbook Air上运行。

Java学习资源

对学习Java感兴趣的同学,可以参考以下学习资源:

先决条件

在你运行这些测试之前,确保你的机器安装了JDK和Maven。

Zulu JDK-aarch64的下载地址在这个页面。在我的M1 Macbook Air上, 该JDK被安装在了如下路径:

/Library/Java/JavaVirtualMachines/zulu-16.jdk

(2020年12月15日更新: 为了让对比测试更加地公平, 最好在i9 Macbook Pro上也使用Zulu JDK, 并且使用和在M1 Macbook Air上版本相同的Zulu JDK。在录制视频时, 我在i9 Macbook Pro上使用的JDK不是Zulu JDK。今天早些时候,我在两台机器上都安装了Zulu Java 8, 又做了一次对比测试。测试结果与我的YouTube视频里的最终结果高度吻合。)

接下来, 下载一个Java repo,比如Apache Commons Lang。

cd
mkdir -p src/apache
cd src/apache
git clone https://github.com/apache/commons-lang.git
cd commons-lang

测试1: 使用JDK-x64, 运行缺省Maven命令

我在M1 Macbook Air和i9 Macbook Pro上都运行了该测试。

此处我假设你的$JAVA_HOME指向的是JDK-x64。

以下是编译命令。

mvn clean compile

如果遇到Too many files with unapproved license这个错误,加一个参数就能解决,像下面这样:

mvn clean -Drat.skip=true compile

该命令的输出会告诉你编译时长。

测试2: 使用JDK-x64, 运行优化过的Maven命令

我在M1 Macbook Air和i9 Macbook Pro上都运行了该测试。

MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" \
mvn clean -T 1C -Drat.skip=true compile -offline

解释:

  • -XX:+TieredCompilation -XX:TieredStopAtLevel=1: 加速JVM的启动速度。
  • -T 1C: 为CPU的每个核都分配一个线程。
  • -offline: 不要从远端repos下载, 以确保整个编译过程都在本地进行运算。

测试3: 使用JDK-aarch64, 运行缺省Maven命令

该测试只在M1 Macbook Air上运行。现在你需要把$JAVA_HOME指向JDK-aarch64。

JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home" \
mvn clean -Drat.skip=true compile

测试4: 使用JDK-aarch64, 运行优化过的Maven命令

该测试只在M1 Macbook Air上运行。现在你需要把$JAVA_HOME指向JDK-aarch64,并且在命令中加入优化参数。

JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home" \
MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" \
mvn clean -T 1C -Drat.skip=true compile -offline

引用

关注我

m1-test's People

Contributors

schelleyyuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

m1-test's Issues

hyper or terminus ?

I remember you recommended a terminal hyper in a video, and I guess you should customize the software appropriately because the default settings are a little too simple. Can you tell me how you customize it?

In addition, I recently found a similar terminal terminus, also very useful.
https://github.com/Eugeny/terminus

image

MacBook Pro 2016 & AMD EPYC 7642 Test Result

晚上看见测试视频,我觉得蛮有意思,自己也找不同环境的测试了一番
包括Sun JDK11,Zulu JDK16

在我的MacBook Pro (15-inch, 2016) 的测试成绩如下:
配置信息:
CPU 2.7 GHz 四核Intel Core i7
OS:Big Sur
内存:16 GB 2133 MHz LPDDR3
JDK:OpenJDK Runtime Environment Zulu16+59-CA (build 16-ea+24)
mvn clean -T 1C -Drat.skip=true compile -offline

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.443 s (Wall Clock)
[INFO] Finished at: 2020-12-15T14:24:27+08:00
[INFO] ------------------------------------------------------------------------

在一台48线程96核的AMD EPYC 7642 服务器上
CPU:EPYC 7642 2.3G 96线程
内存:1TB
OS:CentOS 8
JDK:OpenJDK Runtime Environment Zulu16+59-CA (build 16-ea+24)

mvn clean -T 1C -Drat.skip=true compile -offline
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.583 s (Wall Clock)
[INFO] Finished at: 2020-12-15T02:42:15-05:00
[INFO] ------------------------------------------------------------------------

从监控上看,mvn还是很难利用服务器CPU这么多核心并行编译,基本上就是利用了4个C左右
M1 从多线程性能上肯定比不过96线程的服务器CPU,只是说在相对线程数量不多的情况下,优化的确不错

可以再做一些更多的benchmark,common-lang的代码还是太少

M1 Pro

 Nom du modèle :	MacBook Pro
  Identifiant du modèle :	MacBookPro18,3
  Puce :	Apple M1 Pro
  Nombre total de cœurs :	8 (6 performance et 2 efficacité)
  Mémoire :	16 Go
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Microsoft-26987 (build 17+35)
OpenJDK 64-Bit Server VM Microsoft-26987 (build 17+35, mixed mode)

MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" \
mvn clean -T 1C -Drat.skip=true compile -offline
[INFO] Total time:  1.964 s (Wall Clock)
[INFO] Finished at: 2021-10-30T05:18:06+08:00

Fun for your java comply

  1. the funny things is why do you run apache with Java?
  2. post together with your speed test photo maybe better
  3. you make not very know about the power of i9
    as you are using the notebook Lv CPU if you get the new i9 10000K
    ARM will still lost!
    It doesn't means I'm the intel fan's but if you really wanna make the good test you should peer with ADM
    I'm also the hardware and software engineer.
    It doesn't means you are going the wrong way we most care more about the probuct running on the client site for sale.
    the JDK of MSFT cuz same get some bug for the other process.
    May be this is for your test, but it should not going to work for the stable developer.

Huawei Kunpeng 920 Test

我在想是不是M1是ARM架构的,本身比X86架构在这点上有优势,因此我在huawei cloud上开通了kc1.2xlarge.2 实例
CPU Huawei Kunpeng 920 2.6GHz 8vCPU
内存 16G

  • openjdk version "1.8.0_242" Result
    华为自带
    编译选项:
    增加 -Xms4096m -Xmx4096m
    mvn clean -T 1C -Drat.skip=true compile

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.965 s (Wall Clock)
[INFO] Finished at: 2020-12-16T14:17:22+08:00
[INFO] ------------------------------------------------------------------------
GC策略 猜测CMS

  • 使用zulu JDK15 (无JDK16 Linux ARM版本)
    export JAVA_HOME=/root/zulu15.28.51-ca-jdk15.0.1-linux_aarch64
    export PATH=$JAVA_HOME/bin:$PATH

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.541 s (Wall Clock)
[INFO] Finished at: 2020-12-16T14:18:10+08:00
[INFO] ------------------------------------------------------------------------

GC策略G1

JDK15默认慢一些,而且比我的Macbook Pro 16 2016款更慢
华为自带JDK不认 Unrecognized option: -Xlog:gc*

Alloha!!

  • this issue is only for recording what I fell about ur video. and yes, I just wanna say hi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.