Comments (4)
I had a go at this (as someone who doesn't really know Rust), and the problem I'm hitting is that the floaty From trait has some cleverness to list which types can be safely promoted to floats (and so don't need Options
around the result: http://japaric.github.io/float.rs/src/cast/lib.rs.html#253
That means that lots of the uses of Floaty::cast
in the stats crate return Floaty
.
As far as I can tell num-traits doesn't have this - the ::from
method always returns an Option
so I'm having to sprinkle lots of .unwrap()
s in to compile (which I'm sure is wrong). What's the right way to do this?
Hmm, also num_traits::float::Float
isn't Sync
, so the threads in univariate and bivariate can't share them. There's an issue to implement it though: rust-num/num-traits#8
Maybe num_traits isn't ready to replace Floaty yet?
from criterion.rs.
Hmm. That's unfortunate, I thought num-traits was going to be more or less a drop-in-replacement.
For the options, I think it should be mostly safe to just unwrap them, but it's a bit ugly. You could perhaps try to add a function (or potentially a trait) to keep all of the cast-and-unwrap code in one place until something equivalent is added to num-traits.
As for the Sync, I think it should be possible to add an explict Sync bound to the generics for that function. Again, it can be removed later, when num-traits catches up.
Honestly, num-traits probably isn't ready to replace Floaty yet, but it is actively maintained and doesn't require nightly like Floaty does. I think the best option for now is to make the switch anyway and try to make it so we can remove the workarounds easily later.
Thanks for your help.
from criterion.rs.
Having thought about it some more, I think a good way to do this would be to add a new trait (stats::float::Float
maybe) which extends num-traits' Float and adds the Sync bound and the necessary safe casts and change all of the stats code to use that instead. That way we can rely on num-traits for most of the code and it will be easy to replace our extension trait with num-traits' Float when they provide everything that Criterion needs.
from criterion.rs.
Yeah, that makes sense, I'll have a go at that sometime soon.
from criterion.rs.
Related Issues (20)
- `html_features` report switching graphs within groups
- Ability to provide raw input data? e.g., in order to cse from C++, other languages, complex benchmarks? HOT 2
- iter_batched comments should say clone not to_vec
- Option to disable "Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 89.5s." HOT 2
- Ability to generate self contained pdf report
- Ability to disable warmup
- criterion panicking with `slice.len() > 1 && slice.iter().all(|x| !x.is_nan())` HOT 3
- ANES dependency not maintained anymore & triggers false-positive HOT 1
- Measure throughput & elements
- Next release? HOT 2
- Criterion hangs the process because for some reason the server socket canβt detect that client has closed connection
- OpenMetrics/GitLab integration
- Project does not build due to MSRV HOT 2
- better support for big.LITTLE processors
- I[Idea/Question] Cross-compile a bench test to run on a remote target?
- Where are baselines saved / is there a command to list saved baselines ? HOT 2
- Configuration via env variables
- Huge variance between successive bench runs without code changes. HOT 1
- Bench with huge input
- Unstable feature crate attribute not recognized in different modules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from criterion.rs.