Closed neversi closed 1 year ago
Hi @neversi, would you mind providing some benchmark results for this for previous/now? I'm also curious if there's room to expand this to other frame decoders?
Hi @edaniels, yes of course, I will provide as soon as possible!
Patch coverage: 95.34
% and project coverage change: +0.37
:tada:
Comparison is base (
d561715
) 58.08% compared to head (51e1510
) 58.45%.:exclamation: Current head 51e1510 differs from pull request most recent head 07e2695. Consider uploading reports for the commit 07e2695 to get more accurate results
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@edaniels Here is the result of Benchmarks, I have used benchstat for representation From the comparison it could be seen great reduction in B/ op -> which leads to less pressure on GC
GOMAXPROCS=8
goos: darwin
goarch: arm64
pkg: github.com/pion/mediadevices/pkg/io/video
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
ToI420/480p/I444-8 101.2µ ± 2% 100.7µ ± 3% ~ (p=0.280 n=10)
ToI420/480p/I422-8 54.22µ ± 2% 51.07µ ± 2% -5.81% (p=0.000 n=10)
ToI420/480p/I420-8 11.15n ± 2% 11.86n ± 4% +6.37% (p=0.000 n=10)
ToI420/480p/RGBA-8 267.1µ ± 2% 273.6µ ± 2% +2.46% (p=0.002 n=10)
ToI420/1080p/I444-8 614.2µ ± 8% 584.6µ ± 1% -4.82% (p=0.000 n=10)
ToI420/1080p/I422-8 310.3µ ± 1% 296.1µ ± 0% -4.58% (p=0.000 n=10)
ToI420/1080p/I420-8 11.15n ± 1% 11.81n ± 4% +5.87% (p=0.000 n=10)
ToI420/1080p/RGBA-8 1.634m ± 7% 1.638m ± 2% ~ (p=0.631 n=10)
geomean 22.09µ 22.05µ -0.19%
│ old.txt │ new.txt │
│ B/op │ B/op vs base │
ToI420/480p/I444-8 180224.00 ± 0% 63.50 ± 17% -99.96% (p=0.000 n=10)
ToI420/480p/I422-8 180224.00 ± 0% 63.00 ± 11% -99.97% (p=0.000 n=10)
ToI420/480p/I420-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/480p/RGBA-8 180456.0 ± 0% 327.0 ± 11% -99.82% (p=0.000 n=10)
ToI420/1080p/I444-8 1048577.00 ± 0% 56.00 ± 914% -99.99% (p=0.000 n=10)
ToI420/1080p/I422-8 1048577.0 ± 0% 182.0 ± 70% -99.98% (p=0.000 n=10)
ToI420/1080p/I420-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/1080p/RGBA-8 1032.272Ki ± 0% 9.606Ki ± 12% -99.07% (p=0.000 n=10)
geomean ² -99.66% ²
¹ all samples are equal
² summaries must be >0 to compute geomean
│ old.txt │ new.txt │
│ allocs/op │ allocs/op vs base │
ToI420/480p/I444-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/480p/I422-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/480p/I420-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/480p/RGBA-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/1080p/I444-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/1080p/I422-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/1080p/I420-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ToI420/1080p/RGBA-8 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
geomean ² +0.00% ²
¹ all samples are equal
² summaries must be >0 to compute geomean
What do you mean by "commit the benchmarks in"? In description of PR?
Oh never mind hah. I thought you added new benchmarks. I see you resued.
@edaniels, regarding to expanding pool to other frame decoders, I think it is possible, I will research it on weekends.
Sounds great! Thank you for the contribution
Description
Added sync.Pool to the i420 conversion to minimize overhead of creating new byte slices
Reference issue
Workaround for https://github.com/pion/mediadevices/issues/424
i444ToI420(img image.YCbCr, dst []uint8)
,i422ToI420(img image.YCbCr, dst []uint8)
respectivelyTODO