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

Various optimizations #280

Merged
merged 6 commits into from
Sep 30, 2024
Merged

Various optimizations #280

merged 6 commits into from
Sep 30, 2024

Conversation

reynir
Copy link
Contributor

@reynir reynir commented Sep 27, 2024

These are mostly optimizations from #223 but also some new ones since we have encrypt_into etc. functions.

main-bench.exe is built from 6099a4b (unfortunately without --release)
image

As you can see above there are improvements in execution time, but most notably the number of minor words allocations is almost halved. When testing against an openvpn server I didn't observe much of a difference except, curiously, a slowdown in upload speed (from 826 Mb/s to 757 Mb/s). Why that would I don't know.

@reynir
Copy link
Contributor Author

reynir commented Sep 27, 2024

When testing against an openvpn server I didn't observe much of a difference except, curiously, a slowdown in upload speed (from 826 Mb/s to 757 Mb/s). Why that would I don't know.

Ah! This was with the UDP configuration. With TCP there is a slight speedup (down: 919 Mb/s -> 1.07 Gb/s, up: 599 Mb/s -> 652 Mb/s)

@reynir
Copy link
Contributor Author

reynir commented Sep 28, 2024

I accidentally committed and pushed 15ba1ed and eba6e58 to main. They were a fix to the failing e2e test where I observed locally that it failed due to a Data_v1 packet with key id 0 arriving seemingly just after a successful rekey for key id 1. I don't know if it's the correct thing to do, but to me it seems for data packets we could be more lenient and just drop them.

When decoding operation return offset and length of the package. We
avoid copying the packet only to copy it again without the first byte.
Apply previous post cstruct -> string optimizations:
- 251bed1
- 0de5ad0
- 5ab9523

Furthermore, use decrypt_into and authenticate_decrypt_into.
@reynir
Copy link
Contributor Author

reynir commented Sep 28, 2024

Ah wait the e2e test already fails at the static client configuration. Locally, it initially also failed there for me, but that was due to firewall rules.

@hannesm
Copy link
Contributor

hannesm commented Sep 28, 2024

looks fine to me, may revert the e2e changes and redirect again to /dev/null

Copy link

  0.00 %      0/21     src/cc_message.ml
 80.42 %   1483/1844   src/config.ml
 60.59 %    123/203    src/config_ext.ml
 72.93 %   1002/1374   src/engine.ml
100.00 %      0/0      src/miragevpn.ml
 92.88 %    365/393    src/packet.ml
 20.00 %      1/5      src/result.ml
 82.72 %     67/81     src/state.ml
 62.93 %    146/232    src/tls_crypt.ml
 76.74 %   3187/4153   Project coverage

@reynir
Copy link
Contributor Author

reynir commented Sep 30, 2024

I cleaned up the git history a bit by merging two commits and dropping the CI debugging commit.

It fails on OCaml 5.3~alpha1 due to effect suddenly being a keyword. I'll address this separately.

@reynir reynir merged commit 8d70130 into main Sep 30, 2024
1 of 5 checks passed
@reynir reynir deleted the optimizations branch September 30, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants