Skip to content

OpenVPN: Restore and improve negotiation speed#1095

Merged
keeshux merged 2 commits into
masterfrom
bugfix/openvpn-slow-negotiation
Jan 22, 2025
Merged

OpenVPN: Restore and improve negotiation speed#1095
keeshux merged 2 commits into
masterfrom
bugfix/openvpn-slow-negotiation

Conversation

@keeshux

@keeshux keeshux commented Jan 22, 2025

Copy link
Copy Markdown
Member

The new OpenVPN parser was painfully slow due to allocating NSRegularExpression zillion times, which resulted in poor performance (4x time!) when processing long PUSH_REPLY messages. This is a hard regression from v2 because TunnelKit created the regexes statically.

Solution: pre-allocate the regular expressions at parser creation time.

Optimize long fragmented replies further by catching PUSH_REPLY continuations early, rather than parsing line by line.

@keeshux keeshux self-assigned this Jan 22, 2025
@keeshux keeshux added enhancement New feature or request regression Used to work but doesn't anymore labels Jan 22, 2025
@keeshux keeshux added this to the Hotfixes for v3 milestone Jan 22, 2025
@keeshux keeshux changed the title OpenVPN: Speed up negotiation OpenVPN: Restore and improve negotiation speed Jan 22, 2025
@keeshux keeshux merged commit a13cc34 into master Jan 22, 2025
@keeshux keeshux deleted the bugfix/openvpn-slow-negotiation branch January 22, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request OpenVPN regression Used to work but doesn't anymore

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant