You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Rust Baseline Testing on Google Axion C4A Arm Virtual Machine
2
+
title: Test Rust baseline performance on Google Axion C4A Arm virtual machines
3
3
weight: 5
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Rust Baseline Testing on GCP SUSE VMs
10
-
This guide demonstrates how to perform baseline testing of Rust on GCP SUSE Arm64 VMs, verifying installation, build functionality, and compilation performance on the Arm-based Axion C4A platform.
9
+
## Perform baseline testing
11
10
12
-
### Verify Installation
13
-
Check the Rust version and toolchain setup:
11
+
You can perform baseline testing of Rust on GCP SUSE aarch64 VMs to verify installation, build functionality, and compilation performance on the Arm-based Axion C4A platform.
14
12
15
-
```console
16
-
rustc --version
17
-
cargo --version
18
-
```
19
-
20
-
You should see an output similar to:
21
-
```output
22
-
rustc 1.91.0 (f8297e351 2025-10-28)
23
-
cargo 1.91.0 (ea2d97820 2025-10-10)
24
-
```
13
+
### Create a sample Rust program
25
14
26
-
### Create a Sample Rust Program
27
-
Create and build a simple “Hello, World” application to ensure everything is functioning properly:
15
+
Create and build a simple "Hello, World" application to verify that Rust is working correctly:
28
16
29
17
```console
30
18
mkdir rust-baseline
@@ -33,30 +21,33 @@ cargo new hello
33
21
cd hello
34
22
cargo run
35
23
```
36
-
-**`mkdir rust-baseline`** – Creates a new directory named `rust-baseline`.
37
-
-**`cd rust-baseline`** – Enters the `rust-baseline` directory.
38
-
-**`cargo new hello`** – Creates a new Rust project named `hello` with default files (`main.rs`, `Cargo.toml`).
39
-
-**`cd hello`** – Moves into the newly created `hello` project directory.
40
-
-**`cargo run`** – Compiles and runs the Rust program, printing **“Hello, world!”**, confirming that Rust and Cargo are properly set up.
41
24
42
-
You should see an output similar to:
25
+
This creates a new Rust project and runs it immediately. The `cargo new hello` command generates a default Rust project with the necessary files including `main.rs` and `Cargo.toml`.
This confirms that Rust is working properly on your Arm64 VM.
60
+
61
+
The timing results show that Rust compilation performs well on the Arm64 architecture, with the "real" time indicating the total elapsed time for the build process.
This section demonstrates how to benchmark Rust performance using **official Rust benchmarking tools** — `cargo bench` and the **Criterion** library — to measure code execution speed, stability, and performance consistency on Arm64 hardware.
11
+
This section demonstrates how to benchmark Rust performance using `cargo bench` and the Criterion library to measure code execution speed and performance consistency on aarch64 hardware.
12
12
13
-
### Verify Rust and Cargo
14
-
Ensure that Rust and Cargo are properly installed before running benchmarks
13
+
### Create a benchmark project
15
14
16
-
```console
17
-
rustc --version
18
-
cargo --version
19
-
```
20
-
21
-
You should see an output similar to:
22
-
```output
23
-
rustc 1.91.0 (f8297e351 2025-10-28)
24
-
cargo 1.91.0 (ea2d97820 2025-10-10)
25
-
```
26
-
27
-
### Create a New Rust Project
28
-
Create a new Rust project for benchmarking:
15
+
Create a new Rust project specifically for benchmarking:
29
16
30
17
```console
31
18
cargo new rust-benchmark
32
19
cd rust-benchmark
33
20
```
34
-
### Add Criterion Benchmarking Dependency
35
-
**Criterion** is the officially recommended benchmarking crate for Rust. Add it to your project by editing the `Cargo.toml` file located inside your project root directory using your favorite editor (location example: rust-benchmark/Cargo.toml). Replace your "[dependencies]" tag within your file with this content, then save the file:
21
+
22
+
### Configure Criterion as a dependency
23
+
24
+
Criterion is the recommended benchmarking crate for Rust. Edit the `Cargo.toml` file in your project root directory and replace the existing content with:
36
25
37
26
```toml
38
27
[dependencies]
@@ -42,20 +31,24 @@ criterion = "0.5"
42
31
name = "my_benchmark"
43
32
harness = false
44
33
```
45
-
This enables Criterion for high-precision benchmarking.
46
34
47
-
### Create the Benchmark File
48
-
Create a new benchmark file inside the `benches/` directory using your favorite editor ("edit" used in the example below):
35
+
This configuration enables Criterion for high-precision benchmarking and disables the default test harness.
36
+
37
+
### Create the benchmark directory and file
38
+
39
+
Create the benchmark structure that Cargo expects:
49
40
50
41
```console
51
42
mkdir benches
52
-
edit benches/my_benchmark.rs
53
43
```
54
-
Benchmark files in this directory are automatically detected by Cargo.
55
44
56
-
**Add the Benchmark Code**
45
+
Create a new benchmark file in the `benches/` directory:
46
+
47
+
```console
48
+
edit benches/my_benchmark.rs
49
+
```
57
50
58
-
Paste the following benchmark code:
51
+
Add the following benchmark code to measure Fibonacci number calculation performance:
This code measures how efficiently Rust computes the 20th Fibonacci number.
80
72
81
-
### Run the Benchmark
82
-
Now run the benchmark using Cargo:
73
+
This code implements a recursive Fibonacci function and measures how efficiently Rust computes the 20th Fibonacci number. The `black_box` function prevents the compiler from optimizing away the benchmark.
74
+
75
+
### Run the benchmark
76
+
77
+
Execute the benchmark using Cargo:
83
78
84
79
```console
85
80
cargo bench
86
81
```
87
-
Cargo compiles your code in optimized mode and runs the Criterion benchmarks, showing execution time, performance deviation, and stability metrics for your Rust functions.
88
82
89
-
You should see an output similar to:
83
+
Cargo compiles your code with optimizations enabled and runs the Criterion benchmarks, providing detailed performance metrics.
- The **Fibonacci (n=20)** benchmark demonstrated **consistent performance** with minimal deviation.
113
-
-**Average execution time** was around **12.028 µs**, indicating efficient CPU computation on **Arm64**.
114
-
- Only **1% outliers** were detected, showing **high stability** and **repeatability** of results.
115
-
- Overall, the test confirms **Rust’s reliable execution speed** and **low variance** on the Arm64 platform.
120
+
The Fibonacci benchmark demonstrates consistent performance on the aarch64 platform. The average execution time of 12.028 µs indicates efficient CPU computation, while only 1% of measurements were outliers. This low variance confirms Rust's reliable execution speed and performance stability on aarch64 architecture.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/rust-on-gcp/installation.md
+26-13Lines changed: 26 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,43 +6,56 @@ weight: 4
6
6
layout: learningpathall
7
7
---
8
8
9
-
## Rust Installation on GCP SUSE VM
10
-
This guide explains how to install and configure Rust on a GCP SUSE Arm64 VM, ensuring the environment is ready for building and benchmarking Rust applications.
9
+
## Install Rust
11
10
12
-
### System Preparation
13
-
Updates the system and installs essential build tools for compiling Rust programs.
11
+
This section explains how to install and configure Rust on a GCP SUSE aarch64 VM, preparing your environment for building and benchmarking Rust applications.
12
+
13
+
### Update your system
14
+
15
+
Update the system and install essential build tools required for compiling Rust programs:
14
16
15
17
```console
16
18
sudo zypper refresh
17
19
sudo zypper update -y
18
20
sudo zypper install -y curl gcc make
19
21
```
20
-
### Install Rust Using rustup
21
-
Rust provides an official installer script via `rustup`, which handles the setup automatically:
22
+
23
+
This ensures your system has the latest packages and the necessary compilation tools.
24
+
25
+
### Install Rust using rustup
26
+
27
+
Rust provides an official installer script via `rustup` that handles the setup automatically:
22
28
23
29
```console
24
30
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
25
31
```
26
-
When prompted, you can choose **option 1** (default installation).
27
32
28
-
### Configure Rust Environment
29
-
Activates Rust’s environment variables for the current shell session.
33
+
When prompted, select option 1 for the default installation. This installs the latest stable version of Rust along with Cargo, Rust's package manager and build system.
34
+
35
+
### Configure your environment
36
+
37
+
Activate Rust's environment variables for your current shell session:
30
38
31
39
```console
32
40
source $HOME/.cargo/env
33
41
```
34
42
35
-
### Verify Rust Installation
36
-
Confirms successful installation of Rust and Cargo by checking their versions.
43
+
This command adds the Rust toolchain to your PATH, making the `rustc` compiler and `cargo` commands available.
44
+
45
+
### Verify the installation
46
+
47
+
Confirm that Rust and Cargo installed successfully by checking their versions:
37
48
38
49
```console
39
50
rustc --version
40
51
cargo --version
41
52
```
42
53
43
-
You should see an output similar to:
54
+
The output is similar to:
55
+
44
56
```output
45
57
rustc 1.91.0 (f8297e351 2025-10-28)
46
58
cargo 1.91.0 (ea2d97820 2025-10-10)
47
59
```
48
-
Rust installation is complete. You can now go ahead with the baseline testing of Rust in the next section.
60
+
61
+
Your Rust installation is now complete and ready for development on the aarch64 platform.
0 commit comments