You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we have nothing to catch performance regressions. We have a few benchmarks spread out across repos. No one consistently runs them though.
We should use benchstat, and commit baseline reports in the .github folder. When we see a percentage change (5%?) we should fail the build. IPFS has already implemented it here we just need to port it to GitHub Actions.
@Sean-Der I think it's better to make it pointer not for the performance but to make it less confusing as I wrote: #1540 (review)
Before we would keep a reference internally. Users would be suprised when values on the passed *rtp.Packet would change.
The contents stored as slices are not copied by passing as a value. https://github.com/pion/rtp/blob/c8b3d3ec7ff956797d8d29c5ab1cfb054c9e4028/packet.go#L17-L38
I think it's more confusing than passing as pointer since it's partially copied and partially shared. (both for users and developers)
IMO, it would be better to pass it as a pointer and clone whole packet including its slice members where copy is needed.
I was trying out benchstat on github actions. The results are sometimes inconsistent. I'm currently testing using reference. Idk if this is a worker issue since the test runs on two different jobs in github actions.
All we need to add is to detect % change. I don't think we need to use benchstat. We can compare overall the time taken. (below are overall timing in pairs)
ok github.com/pion/webrtc/v3 87.781s
ok github.com/pion/webrtc/v3 71.302s
ok github.com/pion/webrtc/v3 69.556s
ok github.com/pion/webrtc/v3 57.600s
ok github.com/pion/webrtc/v3 60.695s
ok github.com/pion/webrtc/v3 56.249s
idk about committing reports, as github workers may differ benchmark results
I think the performance on the CI environment really depends on the timing since many CI jobs shares a host machine. (Even if the virtual core is assigned to the job, memory and i/o bandwidth is limited by the host.)
I guess it's better to compare US working hours vs weekend to determine the tolerance.
I am 100% in support of leaving it as a pointer, agree with your points. /v3 needs to go out and I don't think changing it this late is a good idea either.
@scorpionknifes that is a very good point. Maybe we just test the current commit against master? We can always make it optional, even if we get some false positives I think this is a big step in the right direction :)
I'm late to the party but have a couple cents. The discussion is focused on how to track progress with an emphasis on microbenchmarking but I'd like to point out that perhaps this is premature given we don't have much clarity on what we should be measuring (and by extension optimizing). The latter is, admittedly, a trickier problem but my intuition is that we could be more effective if we could find a way to get good profiling data [a] in either real world (which would need to be volunteered) or synthetic (a.k.a macrobenchmarks; this would require compute resources / $$$ that the project may not have access to).
So it seems like it's worth (1) polling users to gather data about the top N bottlenecks [b] that exist in practice. What we learn could then (2) feed into efforts to build the appropriate micro/macro-benchmarks that can reproduce said bottlenecks. And finally, after we have experience on what works well and what doesn't work well (to put another way: what mix of micro & macro benchmarking is appropriate) we could built the appropriate tooling to track progress.
[a] In #1516, I volunteered data collected by adding a couple lines of code to my synthetic load test application. So the friction in enabling data collection is IMO low but is it low enough that we actually convince interested parties to contribute?
[b] To make an analogy, what are current key scaling dimensions and limits of typical systems that are being built.
I think Sean is merely speaking about catching regressions, not about general performance tuning. While microbenchmarks are misleading, they are good for catching regressions, and every performance regression should be investigated, even if it's only so that a human can decide that it doesn't matter in practice.
Having realistic benchmarks would be great, but it's way more ambitious than what Sean is suggesting.
Activity
Sean-Der commentedon Nov 30, 2020
@at-wat @bshi does this sound like a good plan? Any mistakes I am running head first into :)
@ashellunts @scorpionknifes if you are interested this could be a really fun task to take on!
Sean-Der commentedon Nov 30, 2020
I wrote this benchmark, but didn't commit it
at-wat commentedon Nov 30, 2020
@Sean-Der I think it's better to make it pointer not for the performance but to make it less confusing as I wrote: #1540 (review)
scorpionknifes commentedon Dec 2, 2020
I was trying out benchstat on github actions. The results are sometimes inconsistent. I'm currently testing using reference. Idk if this is a worker issue since the test runs on two different jobs in github actions.
The exact code I used is https://github.com/scorpionknifes/webrtc/blob/bench/.github/workflows/bench.yaml
old time and new time are tested on the same code.
All we need to add is to detect % change. I don't think we need to use benchstat. We can compare overall the time taken. (below are overall timing in pairs)
idk about committing reports, as github workers may differ benchmark results
at-wat commentedon Dec 2, 2020
I think the performance on the CI environment really depends on the timing since many CI jobs shares a host machine. (Even if the virtual core is assigned to the job, memory and i/o bandwidth is limited by the host.)
I guess it's better to compare US working hours vs weekend to determine the tolerance.
at-wat commentedon Dec 3, 2020
@Sean-Der any thoughts about #1560 (comment)?
Sean-Der commentedon Dec 3, 2020
@at-wat sorry missed that!
I am 100% in support of leaving it as a pointer, agree with your points.
/v3needs to go out and I don't think changing it this late is a good idea either.Sean-Der commentedon Dec 3, 2020
@scorpionknifes that is a very good point. Maybe we just test the current commit against
master? We can always make it optional, even if we get some false positives I think this is a big step in the right direction :)Sean-Der commentedon Dec 10, 2020
I spent some time doing research today and found https://pythonspeed.com/articles/consistent-benchmarking-in-ci/
cachegrind looks promising! This might be a 'master only' thing depending on how much longer this makes the tests run.
bshi commentedon Dec 10, 2020
I'm late to the party but have a couple cents. The discussion is focused on how to track progress with an emphasis on microbenchmarking but I'd like to point out that perhaps this is premature given we don't have much clarity on what we should be measuring (and by extension optimizing). The latter is, admittedly, a trickier problem but my intuition is that we could be more effective if we could find a way to get good profiling data [a] in either real world (which would need to be volunteered) or synthetic (a.k.a macrobenchmarks; this would require compute resources / $$$ that the project may not have access to).
So it seems like it's worth (1) polling users to gather data about the top N bottlenecks [b] that exist in practice. What we learn could then (2) feed into efforts to build the appropriate micro/macro-benchmarks that can reproduce said bottlenecks. And finally, after we have experience on what works well and what doesn't work well (to put another way: what mix of micro & macro benchmarking is appropriate) we could built the appropriate tooling to track progress.
[a] In #1516, I volunteered data collected by adding a couple lines of code to my synthetic load test application. So the friction in enabling data collection is IMO low but is it low enough that we actually convince interested parties to contribute?
[b] To make an analogy, what are current key scaling dimensions and limits of typical systems that are being built.
jech commentedon Dec 19, 2020
I think Sean is merely speaking about catching regressions, not about general performance tuning. While microbenchmarks are misleading, they are good for catching regressions, and every performance regression should be investigated, even if it's only so that a human can decide that it doesn't matter in practice.
Having realistic benchmarks would be great, but it's way more ambitious than what Sean is suggesting.
JoTurk commentedon Nov 13, 2025
For sctp we'll soon have this tool: pion/scp#1 that we'll also run on the CI.
We'll create similar tools for other libraries where it fits.