-
Notifications
You must be signed in to change notification settings - Fork 992
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
Use BlockSpaceAllocator
to construct new blocks during PrepareProposal
#774
Use BlockSpaceAllocator
to construct new blocks during PrepareProposal
#774
Conversation
cca726c
to
3debb4b
Compare
3debb4b
to
b70d695
Compare
BlockSpaceAllocator
to construct new blocks during PrepareProposal
cda9e25
to
73bb3f2
Compare
25771e1
to
f7ee18a
Compare
This reverts commit 6fc2d46.
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.
lgtm
build-debug: | ||
ANOMA_DEV=false $(cargo) build --package namada_apps --manifest-path Cargo.toml | ||
|
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 useful though would separate it out from this PR, it should go towards main
(maybe build-apps-release
and build-apps-debug
would make more sense as target names but it's separate from this PR)
shared/src/hints.rs
Outdated
//! Compiler hints, to improve the performance of certain operations. | ||
|
||
/// A function that is seldom called. | ||
#[inline] | ||
#[cold] | ||
pub fn cold() {} | ||
|
||
/// A likely path to be taken in an if-expression. | ||
/// | ||
/// # Example | ||
/// | ||
/// ```ignore | ||
/// if likely(frequent_condition()) { | ||
/// // most common path to take | ||
/// } else { | ||
/// // ... | ||
/// } | ||
/// ``` | ||
#[inline] | ||
pub fn likely(b: bool) -> bool { | ||
if !b { | ||
cold() | ||
} | ||
b | ||
} | ||
|
||
/// An unlikely path to be taken in an if-expression. | ||
/// | ||
/// # Example | ||
/// | ||
/// ```ignore | ||
/// if unlikely(rare_condition()) { | ||
/// // ... | ||
/// } else { | ||
/// // most common path to take | ||
/// } | ||
/// ``` | ||
#[inline] | ||
pub fn unlikely(b: bool) -> bool { | ||
if b { | ||
cold() | ||
} | ||
b | ||
} |
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.
Should go towards main
, idk much about this. I'd be slightly hesitant to have optimizations like this at this stage (we should be able to do this sort of thing by profiling anyway - https://doc.rust-lang.org/rustc/profile-guided-optimization.html ?).
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.
I admit I was having way too much fun when I added this module haha
apps/src/lib/node/ledger/shell/prepare_proposal/block_space_alloc.rs
Outdated
Show resolved
Hide resolved
…bridge/use-tx-bins
Based on #791
Plugs the block space allocator implementation into
PrepareProposal
.