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

add inside/outside hot path benchmarks #261

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wadey
Copy link
Member

@wadey wadey commented Jul 28, 2020

These tests will be a bit relative, but can be used to compare the
results before and after a PR. We can also verify that no allocations
are introduced on the hot path, perhaps in a GitHub actions check.

BenchmarkInsideHotPath/AESGCM-4         	  406822	      2879 ns/op	 521.06 MB/s	       1 B/op	       0 allocs/op
BenchmarkInsideHotPath/ChaChaPoly-4     	  368092	      3278 ns/op	 457.61 MB/s	       1 B/op	       0 allocs/op
BenchmarkOutsideHotPath/AESGCM-4        	 1723149	       718 ns/op	2090.07 MB/s	       0 B/op	       0 allocs/op
BenchmarkOutsideHotPath/ChaChaPoly-4    	 1000000	      1108 ns/op	1354.02 MB/s	       0 B/op	       0 allocs/op

Because Interface.outside is not an interface, we have to actually
create a udp socket to write outgoing packets to in BenchmarkInside, so
the results look slower as they involve the kernel write path while
BenchmarkOutside is fully contained.

But we could use this benchmark to compare the results before and after
changing Interface.outside to an interface, as an example.

These tests will be a bit relative, but can be used to compare the
results before and after a PR. We can also verify that no allocations
are introduced on the hot path, perhaps in a GitHub actions check.

    BenchmarkInsideHotPath/AESGCM-4         	  406822	      2879 ns/op	 521.06 MB/s	       1 B/op	       0 allocs/op
    BenchmarkInsideHotPath/ChaChaPoly-4     	  368092	      3278 ns/op	 457.61 MB/s	       1 B/op	       0 allocs/op
    BenchmarkOutsideHotPath/AESGCM-4        	 1723149	       718 ns/op	2090.07 MB/s	       0 B/op	       0 allocs/op
    BenchmarkOutsideHotPath/ChaChaPoly-4    	 1000000	      1108 ns/op	1354.02 MB/s	       0 B/op	       0 allocs/op

Because Interface.outside is not an interface, we have to actually
create a udp socket to write outgoing packets to in BenchmarkInside, so
the results look slower as they involve the kernel write path while
BenchmarkOutside is fully contained.

But we could use this benchmark to compare the results before and after
changing Interface.outside to an interface, as an example.
This is because Interface.outside is not an interface
@CLAassistant
Copy link

CLAassistant commented Feb 17, 2021

CLA assistant check
All committers have signed the CLA.

@wadey wadey added this to the v1.10.0 milestone Apr 30, 2024
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