-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Split bench, test, lib, bin into different workspaces #3360
Conversation
[profile.release] | ||
lto = true | ||
opt-level = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You removed the opt-level
, on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a default setting according to cargo manifests documentation.
# TODO: remove this once rust-lang/rust#50199 is resolved. | ||
codegen-units = 2 | ||
|
||
[profile.bench] | ||
debug = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug mode will very significantly impact performance no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is debug symbols. I think it mostly bloats the file size, instead of slow down the runtime. Anyway, our release build enables this option as well. So in order to make it easy to debug benches, we can enable it for bench as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course. I will keep you updated for this one :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW I think the important thing is to keep the same profile in release and in bench. (debug=true is enabled for release) Otherwise what are we benching for :)
I feel like moving When I look at https://github.com/habitat-sh/habitat/ , which also uses workspaces, they do nothing like this. Instead they split components apart logically. What do you think? On a different point:Would you be willing to split this up and have the other PR resolve these points?
Seems like this would be plenty of changes for one PR and it would make the impact of using workspaces in this way more clear. |
Yes, this is my concern as well 🤣. However this PR is not splitting components (another PR should do this). Also I intentionally moved benches and tests into
This can't be extracted in a single build, because it won't work without a workspace separation 🤣In fact I tried this first, and found out that because the output of
This can be done in separate PRs. However each
This can be done in separate PRs. In fact this is a side effect of changing the clippy command to cover all workspaces 🤣Previously child workspaces are covered.
This one might be possible 🤣However it may be hard to do. I can have a try though. (and you will find that diffs may not be eliminated 🤣) The changes above are not involved with logical changes. As long as the compiling pass, it is safe. What do you think? |
This is a huge change, I suggest you make an agenda and tell others why and how do you want to do @breeswish |
@siddontang Ok |
@breeswish
Oh, I better understand why this happened now. I think it's ok to include that in this PR. Sorry. :)
Hm, I'd like to have a strong motivation to so clearly and strongly break conventions. I worry this will impact our ability to receive new contributions. It is already quite some effort to understand the project, and this will only add to it.
I think this might be a bug. Can we make a reproduction case (a very minimal crate) and open an issue about it? I can do this if you're busy. :)
🤔 My machine spends much more time on kvproto and rocksdb then it does on TiKV. Rebuilding TiKV itself is reasonable. I think it can be faster though.
One thing I did notice though was that
I very much support this effort and would love to see progress towards better compile times and organization, but we should be careful to do it in a way that does not pile us with any technical debt to clean later. This should be a way of relieving some of that debt. |
Update: I believe this issue rust-lang/cargo#1430 involves in this behavior as well. According to the description of this issue, even if our build.rs only changes the result of binary instead of library, cargo will treat it as a change to the library.
Actually it is Cargo building different parts (i.e. tests, libs, bins) of the tikv package. In this PR, since these parts are given different package names, you will see a better progress, like "........ tikv-bin, tikv-lib, tikv-tests".
Agree 🤣 |
I made some new progress about accelerating the bench compiling speed. A new PR which is much more simple than this one will be proposed soon. |
ref #3352 |
What have you changed? (mandatory)
There is a pain point when writing benchmarks for TiKV now: we need to wait several minutes (usually around 10 minutes) even if we only added a blank line to the benchmark suite (
benches
directory).This is caused by several issues:
src/lib.rs
changes at every build, because we embed a UTC build time in it. This dynamic part is now removed from lib.rs, so that it won't trigger a rebuild if its content is not changed.lib.rs
. By splitting benchmarks, tests, libs and binaries into different workspaces, they are isolated and won't affect each other.In addition, this PR made some other improvements together:
#[path = "../../tests/raftstore/..."]
, by introducing library to tests and benches.Check profiling feature under Linux.
Check compile performance when only bench is changed.
As you can see, if we only change benchmarks in the
benches
directory (now it istikv_benches
), it only costs about 6 seconds to compile!What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
CI
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
Refer to a related PR or issue link (optional)
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)