forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory allocated in DataChannel.readLoop
See pion#1516 This patch preserves the semantics of the OnMessage handler and is more safe but less efficient than the patch first described in pion#1516. $ git checkout origin/master datachannel.go && \ go test -bench=. -run=XXX -benchmem -count=10 > original.txt $ git checkout datachannel.go && git apply pool.patch && \ go test -bench=. -run=XXX -benchmem -count=10 > option1.txt $ benchstat original.txt option1.txt name old time/op new time/op delta DSend2-8 20.3µs ±51% 3.7µs ± 6% -81.74% (p=0.000 n=10+10) DSend4-8 23.5µs ±34% 3.6µs ± 8% -84.80% (p=0.000 n=10+8) DSend8-8 18.9µs ±35% 5.8µs ±68% -69.45% (p=0.000 n=9+10) DSend16-8 16.8µs ±30% 10.0µs ±24% -40.77% (p=0.000 n=10+10) DSend32-8 710ms ±100% 0ms ±81% -100.00% (p=0.035 n=10+9) name old alloc/op new alloc/op delta DSend2-8 15.3kB ±89% 1.4kB ± 0% -90.59% (p=0.000 n=9+10) DSend4-8 41.7kB ±63% 1.4kB ± 1% -96.58% (p=0.000 n=10+10) DSend8-8 45.0kB ±33% 1.4kB ± 2% -96.83% (p=0.000 n=9+10) DSend16-8 34.0kB ±69% 1.4kB ± 1% -95.77% (p=0.000 n=10+10) DSend32-8 37.4MB ±388% 0.0MB ± 4% -100.00% (p=0.000 n=10+7) name old allocs/op new allocs/op delta DSend2-8 15.8 ±46% 38.6 ± 2% +144.30% (p=0.000 n=10+10) DSend4-8 27.1 ±48% 38.0 ± 0% +40.22% (p=0.000 n=10+9) DSend8-8 29.3 ±16% 38.0 ± 0% +29.55% (p=0.000 n=9+8) DSend16-8 23.6 ±41% 37.0 ± 0% +56.78% (p=0.000 n=10+9) DSend32-8 19.3k ±100% 0.0k ± 0% ~ (p=0.178 n=10+7)
- Loading branch information
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters