Closed donkeyteethUX closed 1 year ago
I am not entirely convinced increasing the API surface is worth it just to avoid a single ioctl. This might very well be a case of premature optimization. Are you running into some actual issues that motivate this change?
I am not entirely convinced increasing the API surface is worth it just to avoid a single ioctl. This might very well be a case of premature optimization. Are you running into some actual issues that motivate this change?
I only suggested this to be able to pass an &Description
instead of an untyped u32
which seemed a bit more clear to me. It's not premature optimization as much as it is removing unnecessary code that shouldn't have run/been there in the first place, IMO.
@raymanfx agreed that it's not a huge difference. Still, my app calls control()
for each available control inside an egui render loop. This might seem excessive, but it's simpler and safer to keep the driver as the single source of truth rather than caching anything. strace
shows around 1000 ioctl / second before, and 600 after, and the code is slightly more explicit as @MarijnS95 points out.
Bump, after addressing old comment & rebasing this.
@donkeyteethUX reverse bump: this is close to ready if you address the minor but remaining isuses.
@donkeyteethUX reverse bump: this is close to ready if you address the minor but remaining isuses.
Thanks -- will-do when I get a chance. I'm swamped at work but haven't forgotten about it.
Looks good to me. Any objections?
Ping again, we still have two comments open and shouldn't conflate this PR with unrelated clippy changes.
@raymanfx do you mean the API added by this PR specifically, or the control API in general? If anything it seems this function is now more high-level by taking something typed instead of a generic i32
.
I was talking about the API in general. This change is fine and I agree with its premises.
Changes based on discussion on #60, specifically comments from @MarijnS95.
get_control
which takes a&Description
and requires only 1 ioctl.control
getter in favor of more explicitget_control_from_id
(and document preference forget_control
).