Skip to content

Commit 9ac68ee

Browse files
committed
fix graph swap
1 parent 47f516b commit 9ac68ee

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

Diff for: README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,8 @@ I could not get GCC to produce the same `asm` that zig & Rust output. Clang did,
134134

135135
Rust's async/await implementations is the most complicated by far. The resume code is obtuse. You call a `waker` which then calls `poll` on the `future` that then resumes. Callbacks are awkward in Rust because of the borrow checker, so callbacks might not be the baseline to measure from. All this code was run on `release` version, with `native` target and `lto` enabled `rustc 1.55.0`. Writing this code felt like I'm not using async/await the way it was intended. I just shoved into a coroutine looking box. I am an intermediate Rust dev at best. Criticism welcome.
136136
### takeaways
137-
* I can not explain why Suspend and Resume flip places on Intel vs AMD.
137+
* Why are callbacks & resume so different on Intel vs AMD?
138138
* Despite concern about resume complexity, it's snappy on Intel.
139-
* Callbacks seem slow. Might be my code.
140139
* I would use async/await for Rust because it's a better fit for the language.
141140
* There are other issues in Rust that might make it inappropriate for ULL code w/o a profusion of `unsafe`. This specific test does not point to any issues. Promising.
142141

Diff for: benches/bench_atomic.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn rust_suspend(c: &mut Criterion) {
4545
core_affinity::set_for_current(CoreId { id: CLIENT_CPU });
4646

4747
let mut child = async_bench::bench_utils::launch_local(
48-
"target/release/atomic_callback_server",
48+
"target/release/atomic_async_suspend",
4949
vec![SERVER_CPU].as_ref(),
5050
);
5151

@@ -62,7 +62,7 @@ fn rust_callback(c: &mut Criterion) {
6262
core_affinity::set_for_current(CoreId { id: CLIENT_CPU });
6363

6464
let mut child = async_bench::bench_utils::launch_local(
65-
"target/release/atomic_async_suspend",
65+
"target/release/atomic_callback_server",
6666
vec![SERVER_CPU].as_ref(),
6767
);
6868

@@ -276,6 +276,10 @@ fn kotlin_callback(c: &mut Criterion) {
276276

277277
criterion_group!(
278278
benches,
279+
rust_callback,
280+
rust_callback,
281+
rust_callback,
282+
rust_callback,
279283
cpp_bench,
280284
cpp_resume,
281285
cpp_suspend,

Diff for: graphs/rust-AMD.png

-3 Bytes
Loading

Diff for: graphs/rust-Intel.png

3 Bytes
Loading

Diff for: src/bin/atomic_callback_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct EventLoop<'a, T> {
2626

2727
impl<'a, T> EventLoop<'a, T> {
2828

29-
fn set_callback(&mut self, cb:&'a Fn(&mut T, u64) ) {
29+
fn set_callback(&mut self, cb:&'a impl Fn(&mut T, u64) ) {
3030
self.callback = Some(cb);
3131
}
3232

0 commit comments

Comments
 (0)