Skip to content
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

refactor(bench): Dedup bench code and reduce variance between runs #210

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

luukvanderduim
Copy link
Collaborator

  • De duplicate code:
    Moves common code to module that is shared between tests
  • Reduce variance between bench runs:
    Generates test files with randomly generated Messages

- Deduplicate code:
	Moves common code to module that is shared between tests
- Reduce variance between bench runs:
	Generates test files with randomly generated `Messages`
@luukvanderduim
Copy link
Collaborator Author

CI's cargo machete complains about atspi-proxies depending on zvariant.

Maybe we could try pub(crate) use zbus/zvariant as zvariant in the crate and no longer import it ourselves?

@@ -568,7 +568,7 @@ impl TryFrom<&zbus::Message> for EventBodyOwned {

fn try_from(message: &zbus::Message) -> Result<Self, Self::Error> {
let body = message.body();
let signature = body.signature().ok_or_else(|| AtspiError::MissingSignature)?;
let signature = body.signature().ok_or(AtspiError::MissingSignature)?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy complained because of a new lint: needless_lazy_evaluation

This removes the path to the stored `Message`s.
```Rust
cargo bench --quiet
```

or
```
cargo criterion
```

now both work as expected.
The problem was that benc and criterion differ in opinion on the root.
Thus the hard coded relatlive path is a problem.
It is possible to obtain an absolute path at compile time but this relies on
a hack.

criterion will store the files in the workspace root
bench will store the files in the crate root.
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.

1 participant