Closed mooman219 closed 2 years ago
Honestly, the libm stuff seems pretty inoffensive; just the extra dep is the worst of it. Tests are failing, though.
Overlooked the tests in stream, resolved.
The only thing I'm actually worried about is powf performance wise. I'm sure that can be replaced with an approx function if it was actually an issue.
Is there reason to believe that libm::powf
might be slower than std?
Is there reason to believe that libm::powf might be slower than std?
The standard implementation either calls on a hardware implementation, or uses basically the C implementation libm.a
. The problems are: The rust libm
isn't yet up to par with the c libm
, and currently doesn't attempt to use a hardware implementation. An accurate implementation of powf
is incredibly slow. I'm assuming the hardware implementation is fast because between F2XM1
and FSCALE
, x86 can do this pretty fast.
CI / miri (pull_request) Failing after 2m — miri
libm has some target specific implementations, and in this case it's using the square root x86 intrinsic. The miri test doesn't support seem to support that so it's failing CI.
An accurate implementation of powf is incredibly slow.
Ah, that's annoying. I don't suppose rewriting it in terms of exp
would help? It's hard to imagine it being on a hotpath, in any case.
The miri test doesn't support [libm intrinsics] so it's failing CI.
Hmm, that's a problem; oddio is much too cheeky with unsafe to get by without miri. Could we hack around this with #[cfg(miri)]
somehow? Maybe disable no_std
under miri via cfg_attr
(if needed) and fall back on the std impl?
Alot of the code-style that was before could be kept if you also added num-traits as a dependency. I don't know how much num-traits adds to build times and others. It even has powi from the looks of it. And it seems to fix miri when I test it on my machine somehow??
Since this seems to have stalled, I merged the first commit in https://github.com/Ralith/oddio/pull/77 to reduce rebase hazards.
I've updated the PR
This is kind of ugly with libm. It's probably fine enough to just be soft no_std by not taking a direct dependency on std (the first commit). This PR commits to
#![no_std]
with all the caveats.