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

Tweak slice allocation to improve pcap parsing performance. #1034

Closed
wants to merge 2 commits into from

Conversation

gfr10598
Copy link
Contributor

@gfr10598 gfr10598 commented Nov 30, 2021

This is a minor tweak, but useful to get a better baseline before adding a lot more code.

It also adds a better benchmark, that includes accounting for the packets/op, so that it is easier to estimate time and memory allocated per packet.


This change is Reviewable

@gfr10598 gfr10598 changed the title Tweak slice allocation to improve parsing performance. Tweak slice allocation to improve pcap parsing performance. Nov 30, 2021
@coveralls
Copy link
Collaborator

coveralls commented Nov 30, 2021

Pull Request Test Coverage Report for Build 6948

  • 14 of 18 (77.78%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 64.245%

Changes Missing Coverage Covered Lines Changed/Added Lines %
parser/pcap.go 14 18 77.78%
Totals Coverage Status
Change from base Build 6945: 0.03%
Covered Lines: 3856
Relevant Lines: 6002

💛 - Coveralls

Copy link
Contributor

@cristinaleonr cristinaleonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 approvals obtained (waiting on @gfr10598)


parser/pcap.go, line 80 at r2 (raw file):

	pcapSize := len(data) // Only if the data is not compressed.
	// Check magic number?
	if len(data) < 4 {

Would it be more helpful to check for the truncated PCAP earlier?

@stephen-soltesz
Copy link
Contributor

Closing old PR - and referencing the notes from this change in #1085

@stephen-soltesz stephen-soltesz deleted the packet-slice-opt branch August 12, 2022 17:35
@stephen-soltesz stephen-soltesz restored the packet-slice-opt branch August 12, 2022 17:38
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.

4 participants