lace-ws

Crates.iolace-ws
lib.rslace-ws
version1.0.0
created_at2025-10-22 09:01:09.240531+00
updated_at2025-10-22 09:16:33.453378+00
descriptionwork-stealing library based on the lace deque
homepage
repository
max_upload_size
id1895334
size83,450
(daanluth)

documentation

README

lace-ws

The result of a Bachelor thesis around porting the C lace work-stealing library to rust while trying to keep Rust's safety guarantees.
We could surpass Rayon's efficiency on the benchmarks mentioned in the C lace paper, at some ergonomic cost.

This project works well enough to do the experiments necessary for the thesis, it was tested with threadsanitizer and MIRI, so it should be (relatively) bug-free. Adjust your expectations of quality to match the fact that this was done in a couple of weeks with the focus on doing the experiments and exploring the safety-speed tradeoff.
I do not expect to maintain this code, but I also don't expect the dependencies to undergo any breaking changes anytime soon so it should still work when you're reading this (though maybe with more warnings).

example

use lace_ws::{Lace, Worker, lace_task, lace_run};
const N: usize = 40;
#[lace_task]
fn fib(n: usize) -> usize {
    if n < 2 {
        n
    } else {
        let (a, b) = join!(fib(n-1), fib(n-2));
        a + b
    }
}
fn main() {
    let mut lace = Lace::init(4);
    let fib_n = lace_run!(lace, fib(N));
    println!("fib({N}) = {fib_n}");
}

functions marked lace_task may use join!(call1, call2), or a tkn = spawn!(call), result = sync!(tkn) API. To call a lace_task from another lace_task synchronously, there is call!(call)).

Commit count: 0

cargo fmt