Use sigsetjmp instead of setjmp (#2645)

Apparently on macOS `setjmp` manipulates the process-wide signal mask
which adds a good deal of overhead. We don't actually need this
functionality so this commit switches to using the `sig` version of
setjmp/longjmp where we can explicitly ask the signal mask to not get
preserved. This came out of poking around on #2644 and on macOS locally
thi sdropped the overhead from 721ns to 55ns.
This commit is contained in:
Alex Crichton
2021-02-08 12:05:11 -06:00
committed by GitHub
parent 8ee0f09983
commit 5b55ba8053
2 changed files with 24 additions and 4 deletions

View File

@@ -1,7 +1,13 @@
use std::env;
fn main() {
println!("cargo:rerun-if-changed=src/helpers.c");
cc::Build::new()
.warnings(true)
.define(
&format!("CFG_TARGET_OS_{}", env::var("CARGO_CFG_TARGET_OS").unwrap()),
None,
)
.file("src/helpers.c")
.compile("helpers");
}