-
Notifications
You must be signed in to change notification settings - Fork 80
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
add GetAndSet to bitmap #942
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch, that was a pessimisation, did not expect that.
|
|
inlining doesn't seem to have an effect either 🫤 |
these don't use the same bitmap indices so i don't see anything to eliminate by merging them |
precomputing the mask seems to be a very minor pessimization but we can skip one call to
getSlotAndOffset
in(*RTPStatsReceiver).Update
by combining get/set into one method.also some other driveby cleanup
goos: darwin
goarch: arm64
pkg: github.com/livekit/protocol/utils
cpu: Apple M1 Pro
BenchmarkBitmap
BenchmarkBitmap/Set
BenchmarkBitmap/Set-10 584310650 2.055 ns/op
BenchmarkBitmap/Set-10 586064010 2.049 ns/op
BenchmarkBitmap/Set-10 582722875 2.057 ns/op
BenchmarkBitmap/Set-10 585069157 2.063 ns/op
BenchmarkBitmap/Set-10 566389279 2.063 ns/op
PASS
ok github.com/livekit/protocol/utils 15.692s
goos: darwin
goarch: arm64
pkg: github.com/livekit/protocol/utils
cpu: Apple M1 Pro
BenchmarkBitmap
BenchmarkBitmap/Set
BenchmarkBitmap/Set-10 591135066 2.030 ns/op
BenchmarkBitmap/Set-10 592524807 2.055 ns/op
BenchmarkBitmap/Set-10 585467359 2.022 ns/op
BenchmarkBitmap/Set-10 591682300 2.024 ns/op
BenchmarkBitmap/Set-10 593558163 2.027 ns/op