Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
90ba703
colors: drop libc invocations for `var_os`
NotAShelf Mar 25, 2026
72de007
desktop: replace `libc::getenv` with `env::var_os`
NotAShelf Mar 25, 2026
f6f1b30
syscall: wrap Linux syscalls directly to replace libc
NotAShelf Mar 25, 2026
99f7be5
microfetch-lib: use home-made syscall wrappers over `libc::uname`
NotAShelf Mar 25, 2026
17cd753
uptime: construct a raw buffer for the sysinfo syscall; drop `libc::s…
NotAShelf Mar 25, 2026
99e033c
system: use `std::env::var_os` over `libc` helpers
NotAShelf Mar 25, 2026
a798c5d
chore: drop libc from crate dependencies
NotAShelf Mar 25, 2026
0c294d3
various: fix clippy lints
NotAShelf Mar 25, 2026
1dd02de
lib: fix aarch64 build by casting `UtsNameBuf` field pointers to `c_c…
amaanq Mar 26, 2026
bf1b319
Merge pull request #54 from NotAShelf/notashelf/push-ypvyyznuosqk
NotAShelf Mar 26, 2026
b4d3b92
microfetch: consume library exports in binary crate
NotAShelf Mar 25, 2026
928452f
chore: enable explicit ABI for rustfmt
NotAShelf Mar 25, 2026
1408ca9
treewide: break into multiple crates
NotAShelf Mar 27, 2026
1c781af
chore: don't benchmark binary crate; centralize assembly helpers
NotAShelf Mar 27, 2026
0d4377f
ci: use cargo-cross for multi-arch testing
NotAShelf Mar 27, 2026
35d0f67
chore: use clang only on `x86_64-unknown-linux-gnu`
NotAShelf Mar 27, 2026
26c7a9f
ci: use hotpath-utils for benchmark workflows
NotAShelf Mar 27, 2026
d8da221
ci: use mold globally; drop clang linker
NotAShelf Mar 27, 2026
23e994a
ci: make Mold the default linker
NotAShelf Mar 27, 2026
77d9c72
meta: move benchmarks to dedicated crate
NotAShelf Mar 27, 2026
325bc7a
Merge pull request #56 from NotAShelf/notashelf/push-kpolspkuxwln
NotAShelf Mar 27, 2026
1b0e307
crates: make assembly helpers no_std
NotAShelf Mar 27, 2026
472dbfc
treewide: going no_std
NotAShelf Mar 27, 2026
0f5fc12
crates/asm: replicate some libc runtime symbols manually, unsafely
NotAShelf Mar 27, 2026
d6977ba
various: (ab)use the new syscall wrappers and symbols; drop libc enti…
NotAShelf Mar 27, 2026
5ce0f3b
nix: use mold on all Linux targets; fix source filters
NotAShelf Mar 27, 2026
781de52
build: be more aggressive with linker optimizations; wrap mold
NotAShelf Mar 27, 2026
3b823a0
nix: fix
NotAShelf Mar 27, 2026
d49e75b
ci: stop overriding .cargo/config.toml rustflags in CI workflows
amaanq Mar 27, 2026
308ca53
ci: add missing mold linker setup to hotpath-profile workflow
amaanq Mar 27, 2026
6ca8301
Merge pull request #58 from amaanq/fix-ci-rustflags
NotAShelf Mar 27, 2026
ddca757
crates/asm: add bcmp and memcmp for static linking without libc
amaanq Mar 27, 2026
9e13a6f
build: move link flags to build.rs, scope config.toml per-triple
amaanq Mar 27, 2026
04e4e44
microfetch: move _start entry point from asm lib to binary crate
amaanq Mar 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# https://github.com/rui314/mold?tab=readme-ov-file#how-to-use
[target.'cfg(target_os = "linux")']
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
# Link-args like -nostartfiles and -static are in microfetch/build.rs using
# cargo:rustc-link-arg-bin so they only affect the final binary and don't
# break proc-macro or build-script linking.

[target.x86_64-unknown-linux-gnu]
rustflags = [
"-C",
"force-unwind-tables=no",
]

[target.aarch64-unknown-linux-gnu]
rustflags = [
"-C",
"force-unwind-tables=no",
]

[target.riscv64gc-unknown-linux-gnu]
rustflags = [
"-C",
"force-unwind-tables=no",
]
50 changes: 16 additions & 34 deletions .github/workflows/hotpath-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,31 @@ jobs:
comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v4

- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Download profiling results
uses: actions/download-artifact@v8
- uses: actions/download-artifact@v4
with:
name: hotpath-results
path: /tmp/
name: profile-metrics
path: /tmp/metrics/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Install hotpath CLI
run: cargo install hotpath

- name: Post timing comparison comment
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
HEAD_METRICS=$(cat /tmp/head_timing.json)
BASE_METRICS=$(cat /tmp/base_timing.json)
PR_NUMBER=$(cat /tmp/pr_number.txt)
hotpath profile-pr \
--head-metrics "$HEAD_METRICS" \
--base-metrics "$BASE_METRICS" \
--github-token "$GH_TOKEN" \
--pr-number "$PR_NUMBER"
- name: Install hotpath-utils CLI
run: cargo install hotpath --bin hotpath-utils --features=utils

- name: Post allocation comparison comment
- name: Post PR comment
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
HEAD_METRICS=$(cat /tmp/head_alloc.json)
BASE_METRICS=$(cat /tmp/base_alloc.json)
PR_NUMBER=$(cat /tmp/pr_number.txt)
hotpath profile-pr \
--head-metrics "$HEAD_METRICS" \
--base-metrics "$BASE_METRICS" \
export GITHUB_BASE_REF=$(cat /tmp/metrics/base_ref.txt)
export GITHUB_HEAD_REF=$(cat /tmp/metrics/head_ref.txt)
hotpath-utils profile-pr \
--head-metrics /tmp/metrics/head_timing.json \
--base-metrics /tmp/metrics/base_timing.json \
--github-token "$GH_TOKEN" \
--pr-number "$PR_NUMBER"
--pr-number "$(cat /tmp/metrics/pr_number.txt)" \
--benchmark-id "timing"
90 changes: 45 additions & 45 deletions .github/workflows/hotpath-profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,62 @@ on:
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
permissions:
contents: read

jobs:
profile:
runs-on: ubuntu-latest

steps:
- name: Checkout PR HEAD
uses: actions/checkout@v6
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run timing profiling on HEAD

- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""

- name: Make Mold the default linker
uses: rui314/setup-mold@v1

- name: Create metrics directory
run: mkdir -p /tmp/metrics

- name: Head benchmark (timing)
env:
HOTPATH_JSON: "true"
run: |
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/head_timing.json
- name: Run allocation profiling on HEAD
HOTPATH_OUTPUT_FORMAT: json
HOTPATH_OUTPUT_PATH: /tmp/metrics/head_timing.json
run: cargo run -p microfetch --release --features='hotpath'

- name: Head benchmark (alloc)
env:
HOTPATH_JSON: "true"
run: |
cargo run --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/head_alloc.json

- name: Checkout base branch
run: |
git checkout ${{ github.event.pull_request.base.sha }}

- name: Run timing profiling on base
HOTPATH_OUTPUT_FORMAT: json
HOTPATH_OUTPUT_PATH: /tmp/metrics/head_alloc.json
run: cargo run -p microfetch --release --features='hotpath,hotpath-alloc'

- name: Checkout base
run: git checkout ${{ github.event.pull_request.base.sha }}

- name: Base benchmark (timing)
env:
HOTPATH_JSON: "true"
run: |
cargo run --features='hotpath' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/base_timing.json || echo '{}' > /tmp/base_timing.json
- name: Run allocation profiling on base
HOTPATH_OUTPUT_FORMAT: json
HOTPATH_OUTPUT_PATH: /tmp/metrics/base_timing.json
run: cargo run -p microfetch --release --features='hotpath' || echo '{}' > /tmp/metrics/base_timing.json

- name: Base benchmark (alloc)
env:
HOTPATH_JSON: "true"
run: |
cargo run --features='hotpath,hotpath-alloc' 2>&1 | grep '^{"hotpath_profiling_mode"' > /tmp/base_alloc.json || echo '{}' > /tmp/base_alloc.json
- name: Save PR number
HOTPATH_OUTPUT_FORMAT: json
HOTPATH_OUTPUT_PATH: /tmp/metrics/base_alloc.json
run: cargo run -p microfetch --release --features='hotpath,hotpath-alloc' || echo '{}' > /tmp/metrics/base_alloc.json

- name: Save PR metadata
run: |
echo '${{ github.event.pull_request.number }}' > /tmp/pr_number.txt

- name: Upload profiling results
uses: actions/upload-artifact@v7
echo '${{ github.event.pull_request.number }}' > /tmp/metrics/pr_number.txt
echo '${{ github.base_ref }}' > /tmp/metrics/base_ref.txt
echo '${{ github.head_ref }}' > /tmp/metrics/head_ref.txt

- uses: actions/upload-artifact@v4
with:
name: hotpath-results
path: |
/tmp/head_timing.json
/tmp/head_alloc.json
/tmp/base_timing.json
/tmp/base_alloc.json
/tmp/pr_number.txt
name: profile-metrics
path: /tmp/metrics/
retention-days: 1
35 changes: 13 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ env:
jobs:
test:
name: Test on ${{ matrix.target }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu

steps:
- name: "Checkout"
Expand All @@ -30,25 +29,17 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
rustflags: ""

- name: "Install cross-compilation tools"
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: "Configure linker for aarch64"
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
mkdir -p .cargo
cat >> .cargo/config.toml << EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
EOF
- name: "Make Mold the default linker"
uses: rui314/setup-mold@v1

- name: "Install cross"
run: cargo install cross --git https://github.com/cross-rs/cross

- name: "Build"
run: cargo build --verbose --target ${{ matrix.target }}
run: cross build --verbose --target ${{ matrix.target }}

- name: "Run tests"
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: cargo test --verbose --target ${{ matrix.target }}
run: cross test --verbose --target ${{ matrix.target }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/target
**/target
result*
/.direnv
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ condense_wildcard_suffixes = true
doc_comment_code_block_width = 80
edition = "2024" # Keep in sync with Cargo.toml.
enum_discrim_align_threshold = 60
force_explicit_abi = false
force_explicit_abi = true
force_multiline_blocks = true
format_code_in_doc_comments = true
format_macro_matchers = true
Expand Down
Loading
Loading