Skip to content

how to use cargo in the benchmarks game #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BurntSushi opened this issue Jun 24, 2015 · 5 comments
Closed

how to use cargo in the benchmarks game #3

BurntSushi opened this issue Jun 24, 2015 · 5 comments

Comments

@BurntSushi
Copy link
Contributor

I just went through the process of getting the regex benchmark updated (because it recently got a lot of optimizations), and this required Cargo because regex now has four total dependencies: regex-syntax, aho-corasick, memchr and libc.

It was a little tricky to get working because the maintainer still needs to be able to run rustc on the submitted benchmark.

Here is the thread: https://alioth.debian.org/tracker/index.php?func=detail&aid=315089&group_id=100815&atid=413122

The approach we finally settled on was to set up a blank Cargo project with regex as a dependency, cargo build --release it, and then use rustc with -L with the ./target/release/deps directory:

$ ls
regex-dna.rs
$ cargo new regex-deps
$ printf '[dependencies]\nregex = "=0.1.38"\n' >> regex-deps/Cargo.toml 
$ cargo build --release --manifest-path regex-deps/Cargo.toml 
$ rustc -C opt-level=3 -C lto -L ./regex-deps/target/release/deps/ regex-dna.rs -o regex-dna
$ ./regex-dna < /data/regex-dna.fasta

This does fail on 32 bit unfortunately, as can be seen here at the bottom of the list: http://benchmarksgame.alioth.debian.org/u32/performance.php?test=regexdna I filed a bug with rustc: rust-lang/rust#26541

I'm hoping this info is useful enough so that we can:

  1. Get this build process setup in this repo so that the regex benchmark can be maintained here.
  2. Possibly do something similar for other benchmarks that are allowed to use a library.
@BurntSushi
Copy link
Contributor Author

I talked to @alexcrichton on IRC, and he seems to think the 32 bit problem is an LTO related bug. Perhaps we could open a new thread in the benchmark game forum and ask the maintainer to not use LTO? (I guess this might be a question that must be answered for all Rust benchmarks.)

@BurntSushi
Copy link
Contributor Author

@TeXitoi The maintainer has stated that we can selectively disable LTO on certain benchmarks. I'm in favor of disabling it for regex-dna at least, but we can't go back and forth on it with the Benchmark Game as the intermediate. Is there anyone else I should speak with?

@TeXitoi
Copy link
Owner

TeXitoi commented Jun 25, 2015

I'm OK to disable lto everywhere.

I'll look for the cargo installation with dependencies.

Sorry I'm quite busy now, I don't know when I'll have time to do that.

@llogiq
Copy link
Contributor

llogiq commented Sep 21, 2015

I think I have it working now. I'll push a PR shortly.

@TeXitoi
Copy link
Owner

TeXitoi commented Sep 22, 2015

closed by #13

@TeXitoi TeXitoi closed this as completed Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants