Skip to content

src/fut_with_diag: Reduce overhead when logging disabled#1

Merged
tomaka merged 1 commit intotomaka:masterfrom
mxinden:safe-on-instant-now-calls
Jan 29, 2020
Merged

src/fut_with_diag: Reduce overhead when logging disabled#1
tomaka merged 1 commit intotomaka:masterfrom
mxinden:safe-on-instant-now-calls

Conversation

@mxinden
Copy link
Contributor

@mxinden mxinden commented Jan 29, 2020

DiagnoeFuture::poll either just polls the underlying future when
logging is disabled, or records the start time, polls the future,
records the end time, logs the information and then returns the poll
outcome.

In the former case where logging is disabled, there is no reason to
record start and end time, given that log_poll becomes a no-op.

This might just be optimized away by the compiler anyways. But given that it simplifies the code with an early return as well, I think it is worth doing.

Related to paritytech/substrate#4752.

`DiagnoeFuture::poll` either just polls the underlying future when
logging is disabled, or records the start time, polls the future,
records the end time, logs the information and then returns the poll
outcome.

In the former case where logging is disabled, there is no reason to
record start and end time, given that `log_poll` becomes a no-op.
@tomaka tomaka merged commit ca330af into tomaka:master Jan 29, 2020
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