๐Ÿ“ฆ siedentop / pmpf-code-rust

Hilbert curve but in Rust for j2kun/pmpf-code

โ˜… 1 stars โ‘‚ 0 forks ๐Ÿ‘ 1 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/siedentop/pmpf-code-rust.git
HTTPS git clone https://github.com/siedentop/pmpf-code-rust.git
SSH git clone git@github.com:siedentop/pmpf-code-rust.git
CLI gh repo clone siedentop/pmpf-code-rust
Christoph Siedentop Christoph Siedentop README mentions feature flag 54b7315 4 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ src
๐Ÿ“„ .gitignore
๐Ÿ“„ Cargo.lock
๐Ÿ“„ Cargo.toml
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ README.md

About this code

This repository contains code for matrix multiplication using Hilbert Curves.

The original code ([2]) is part of @j2kun's code for his next book [3]. It was written in Python -- but Python did not show the expected performance benefit of using the Hilbert Curve for matrix multiplication (as compared to a naive multiplication).

Thus I decided to give it a go in a compiled language.

How to run

  • Install a Rust toolchain from here: https://rustup.rs
  • Run cargo run --release
  • Observe the following output:
Initial data generation: 0.061384752s
hilbert data preprocessing: 0.21851613s
Naive: 0.0115141s (0.0005757049999999999s per)
Hilbert: 0.0090037s (0.000450185 s per)
Improvement: 21.802833048175707%

(Tested on my M1 Macbook Air, RustC 1.56.0)

Apple Silicon devices

There is a feature flag, called macos-perf, which provides more details on macOS M1-based computers.

Run: sudo cargo run --features macos-perf --release --quiet --bin example to see more detailed results.