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

Make Debug impls optional #482

Merged
merged 3 commits into from
Dec 22, 2021
Merged

Make Debug impls optional #482

merged 3 commits into from
Dec 22, 2021

Conversation

Ralith
Copy link
Collaborator

@Ralith Ralith commented Oct 16, 2021

When disabled, this buys us a ~12% reduction in buildtime in my environment

I'd like some discussion on whether it should be enabled by default. It's less breaking that way, but I dunno how often people are going to scan the feature list for opportunities to improve buildtime.

@i509VCB
Copy link
Contributor

i509VCB commented Oct 21, 2021

I wonder should we list available features in the readme so people know the built time optimizations exist.

@Ralith
Copy link
Collaborator Author

Ralith commented Dec 21, 2021

Since nobody seems to feel strongly, I've updated this to disable the feature by default.

@MarijnS95
Copy link
Collaborator

MarijnS95 commented Dec 21, 2021

I'm tracking the windows-rs repository, and users seem rather disgruntled by the removal of Debug. Not sure if they'd be as unhappy if there was a debug feature, even id disabled by default.

@Ralith Ralith force-pushed the optional-debug branch 2 times, most recently from 723ef6b to 37569f3 Compare December 21, 2021 00:57
@Ralith
Copy link
Collaborator Author

Ralith commented Dec 21, 2021

I don't have enough experience with winapi to judge how the usage patterns might vary. I'd rather have this in but enabled by default than not in at all, if that's your preference? I'll ask around and see if anyone I know would be impacted; hard to predict in general.

@MarijnS95
Copy link
Collaborator

windows-rs, the replacement for winapi - gauging the few replies and thumbs up here, and the Rust API guidelines suggesting to implement it for public types: https://rust-lang.github.io/api-guidelines/debuggability.html#all-public-types-implement-debug-c-debug it seems better to leave it on by default? I'm still fine with having it as feature of course.

OTOH I'm not sure how useful our limited debugging implementation is: we don't even (and for good reason) dereference and follow pointers. Still, at least being able to see pointer values and everything else that's not a pointer already goes a long way. Still on the fence about default-enabling or disabling it...

@Ralith
Copy link
Collaborator Author

Ralith commented Dec 21, 2021

I think our current Debug impls are trivially useful for output structures, and potentially useful for input structures that might get handled by intermediate layers of abstractions in user code. Sure, a lot of stuff needs pointer context for completeness, but lots of stuff doesn't as well; e.g. being able to quickly and easily inspect memory barriers seems convenient.

Given the uncertainty, I think it's better for us to merge this with the feature enabled by default than agonize over it, so I've turned it back on. We can always disable in the future.

@MarijnS95
Copy link
Collaborator

@Ralith On my machine I can win another 400-500ms (7.9s down to 7.4s) by removing const_debugs: Ralith/ash@optional-debug...MaikKlein:optional-debug

We may want to preserve just the debug for Result though?

@Ralith
Copy link
Collaborator Author

Ralith commented Dec 21, 2021

I preserved Result (for unwrap()) and ObjectType (for debug messenger purposes).

When disabled, this buys us a 12% reduction in buildtime.
Copy link
Collaborator

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

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

LGTM!

(I hope nobody notices the cfg_attr being below instead of above the derives like in vk/definition.rs - I did 😬)

@Ralith Ralith merged commit 45301ff into ash-rs:master Dec 22, 2021
@Ralith Ralith deleted the optional-debug branch December 22, 2021 01:02
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.

3 participants