Page MenuHomeFreeBSD

sound: Cache bps in pcm/feeder_eq.c
AbandonedPublic

Authored by christos on Wed, Dec 11, 4:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 11:12 PM
Unknown Object (File)
Sun, Dec 22, 7:14 AM
Unknown Object (File)
Wed, Dec 18, 7:09 PM
Unknown Object (File)
Fri, Dec 13, 12:32 PM
Subscribers

Details

Summary

This value remains stable, so cache it to avoid unnecessary
computations.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61187
Build 58071: arc lint + arc unit

Event Timeline

Why not just cache it in a local variable? That's probably cheaper, even though the "computation" here is trivial anyway.

I'm skeptical that this change makes any measurable difference. And, as suggested, it'd be more natural to cache the value in a local variable instead, assuming that the compiler doesn't recognize that the value is constant and hoist that computation out the loop (which would make this diff even less useful).

sys/dev/sound/pcm/feeder_eq.c
277

Shouldn't this be info->bps = AFMT_BPS(info->fmt)? It's not clear to me that these are the same.

christos marked an inline comment as done.

Cache bps in a local variable.

as suggested, it'd be more natural to cache the value in a local variable instead, assuming that the compiler doesn't recognize that the value is constant and hoist that computation out the loop (which would make this diff even less useful).

Does this diff actually change the generated code? We should avoid these kinds of microoptimizations unless they can be proven to be useful.

as suggested, it'd be more natural to cache the value in a local variable instead, assuming that the compiler doesn't recognize that the value is constant and hoist that computation out the loop (which would make this diff even less useful).

Does this diff actually change the generated code? We should avoid these kinds of microoptimizations unless they can be proven to be useful.

I guess the change is either not-noticeable, or non-existent. Perhaps it's better to skip this patch.