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

Gate some commonly unused traits behind a feature #884

Merged
merged 6 commits into from
Oct 13, 2023

Conversation

notgull
Copy link
Collaborator

@notgull notgull commented Oct 6, 2023

Adds an extra-traits feature that gates some of the less-commonly-used traits. It also reimplements Debug using a more simple implementation if it is disabled and disables request parsing.

Using this as a benchmark:

$ cargo clean && cargo build --no-default-features -F xfixes,randr,xkb,xinput

master is currently 19.62s to build on my laptop. This branch builds in 10.41s. That is almost halving the compile time, by my measurements. Definitely still needs improvement but at least we aren't the slowest build in alacritty's tree anymore.

This is a breaking change.

cc #883

This is a breaking change

Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 1127 lines in your changes are missing coverage. Please review.

Comparison is base (aca14e3) 12.75% compared to head (b0157b2) 12.75%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master     #884     +/-   ##
=========================================
  Coverage   12.75%   12.75%             
=========================================
  Files         189      189             
  Lines      138232   140569   +2337     
=========================================
+ Hits        17635    17934    +299     
- Misses     120597   122635   +2038     
Flag Coverage Δ
tests 12.75% <7.92%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
generator/src/generator/namespace/helpers.rs 95.28% <100.00%> (+0.23%) ⬆️
generator/src/generator/namespace/request.rs 96.58% <100.00%> (+0.09%) ⬆️
generator/src/generator/namespace/struct_type.rs 97.90% <100.00%> (+0.04%) ⬆️
generator/src/generator/namespace/switch.rs 80.78% <100.00%> (+0.28%) ⬆️
generator/src/generator/requests_replies.rs 100.00% <100.00%> (ø)
x11rb-protocol/src/protocol/glx.rs 0.00% <ø> (ø)
x11rb-protocol/src/protocol/mod.rs 2.11% <ø> (ø)
x11rb-protocol/src/protocol/randr.rs 0.43% <ø> (-0.01%) ⬇️
x11rb-protocol/src/protocol/xinput.rs 0.27% <ø> (-0.01%) ⬇️
x11rb-protocol/src/protocol/xkb.rs 0.00% <ø> (ø)
... and 31 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@psychon psychon left a comment

Choose a reason for hiding this comment

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

I think these new features should also somehow show up in .github/workflows/CI.yml. I'm not quite sure how. I am not even sure whether this needs to be added there or if --all-features is enough...

x11rb-protocol/src/protocol/bigreq.rs Show resolved Hide resolved
x11rb-protocol/src/protocol/composite.rs Show resolved Hide resolved
x11rb-async/Cargo.toml Show resolved Hide resolved
x11rb/Cargo.toml Show resolved Hide resolved
@psychon
Copy link
Owner

psychon commented Oct 6, 2023

Oh and for the test failures: I guess at least non-amd64-test, windows-stable and non-linux-unix-test should build with the feature enabled (= this needs to be added to MOST_FEATURES at the beginning of the file).

But... should cargo test succeed without enabling extra features? I'm a bit surprised that nothing else here failed...

Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
@@ -21,9 +21,17 @@ serde = { version = "1", features = ["derive"], optional = true }
criterion = "0.5"

[features]
default = ["std"]
default = ["extra-traits", "std"]
Copy link
Owner

Choose a reason for hiding this comment

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

Hm.... do we really want this to be enabled by default?

Well... I guess it does not matter for now. 🤷

Copy link
Owner

psychon commented Oct 13, 2023

@Mergifyio refresh

@psychon psychon merged commit 55ba7b0 into master Oct 13, 2023
22 of 23 checks passed
@psychon psychon deleted the notgull/less-codegen branch October 13, 2023 14:42
@mergify
Copy link
Contributor

mergify bot commented Oct 13, 2023

refresh

✅ Pull request refreshed

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