Skip to content

Add benchmark tests for mbe #7566

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

Merged
merged 1 commit into from
Feb 27, 2021
Merged

Conversation

edwin0cheng
Copy link
Member

This PR add more real world tests dumped from rust-analyzer analysis-stats . to benchmark its performance.

cc #7513

r? @matklad

@edwin0cheng
Copy link
Member Author

CI had passed. I forgot I have to ignore some tidy tests in test fixtures :)

@matklad
Copy link
Member

matklad commented Feb 5, 2021

Hm, 6mb file seems a bit excessive to keep in git repo 🤣

It was generated by some code, right? Lets' maybe ignore this file via .gitignore, but commit the code to create it. So that benchmargks look like this:

#[test]
fn benchmark_foo() {
    if skip_slow_tests() { return; }
    // Uses Once to create `target/bench_data/lotsofrust.rs`
    let bf = BenchmarkFixtures::new();
    let file: String = bf.get("many-macros.rs").
}

I think it does make sense to write to disk, so that benchmark generation doesn't affect profiles

@edwin0cheng
Copy link
Member Author

Its generated by some hacky awk scripts and adhoc dbg output... but well, I agree that it is too large :)

Let me try to write a proper generation code and see how’s it is.

@edwin0cheng
Copy link
Member Author

Instead of a large file for macro invocation fixtures, I am able to generate invocations from MacroRules. The generate code itself is quite fast (and dirty) so I decided no need to write it back to disk.

It is ready to review again :)

@matklad
Copy link
Member

matklad commented Feb 27, 2021

bors r+

Nice!

@bors
Copy link
Contributor

bors bot commented Feb 27, 2021

@bors bors bot merged commit a8cf346 into rust-lang:master Feb 27, 2021
@edwin0cheng edwin0cheng deleted the mbe-benchmark branch February 27, 2021 16:58
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

Successfully merging this pull request may close these issues.

2 participants