TeXitoi / benchmarksgame-rs

The Computer Language Benchmarks Game: Rust implementations
Other
70 stars 19 forks source link

New fasta #15

Closed Veedrac closed 9 years ago

Veedrac commented 9 years ago

I gave my variant of fasta on the Benchmarks Game tracker and got directed here for comments.

The basic idea was that the x86 one core benchmarks put Haskell well in the lead. I just took the multithreaded Rust program and copied Haskell's implementation.

This has two main techniques:

Then I parallelized the RNG by implementing a somewhat trivial future method that allows getting parallel streams of the same RNG. This makes parallelism on my two cores almost 100% efficient, although I've no idea what'll happen with more than two.

I also stole the while let Err(_) = wr.lock().unwrap().write(...) idea, but I added a std::thread::yield_now(). IIRC, it seems to help, although I can't remember by how much.

I can make a pull request if wanted.

TeXitoi commented 9 years ago

The idea here is, if possible, first commit your version in the official rust repo. You can open a pull request here, and we (well, at least me) will comment on it, but it will be merged after being merged to the rust repo. Then, it may be easier to first be reviewed here before on the rust repo.

I propose you open a PR, or you open a PR on rust repo and link to here, as you wish.

Thanks for contributing :)

llogiq commented 9 years ago

I think the same technique should also be applicable to fasta-redux.

kud1ing commented 9 years ago

Upstream PR seems to be https://github.com/rust-lang/rust/pull/28623

llogiq commented 9 years ago

Exactly. Veedrac asked me to submit it for him, because I have a faster machine and could build it in less time.

kud1ing commented 9 years ago

I've seen the PR in the fasta-redux issue and just wanted to connect the PR to this issue, too.

llogiq commented 9 years ago

Yeah, once upstream merges my PR, I'll ask teXitoi to merge #20 and submit the fasta_redux to the benchmarksgame tracker, too.