Skip to content
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

Packet pool optimisations #44

Merged
merged 6 commits into from
Dec 29, 2022

Conversation

k-danil
Copy link
Contributor

@k-danil k-danil commented Dec 28, 2022

Good day!

This commit introduce two optimisations for Packet pool:

  • Replace parseData with isPSIComplete function. This function checks for advertised section length and compare it with length of actual data in accumulator.
  • Allocate slices with capacity of previous one. For PES packets this will significantly reduce reallocation count.

Benchmarks:
Now:

BenchmarkDemuxer_NextData
BenchmarkDemuxer_NextData-8   	  102381	     11409 ns/op	   15247 B/op	     300 allocs/op
PASS

Patch:

BenchmarkDemuxer_NextData
BenchmarkDemuxer_NextData-8   	  263058	      4471 ns/op	    6666 B/op	     125 allocs/op
PASS

Please check.

@asticode asticode merged commit b10d419 into asticode:master Dec 29, 2022
@asticode
Copy link
Owner

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants