- Notifications
You must be signed in to change notification settings - Fork13.3k
Reduce BearSSL code size by not -O2 FSMs#7807
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The FSMs that drive the encryption logic are not performance critical,but they are very large. Build BearSSL using -Os on them, leaving -O2everywhere else (i.e. encryption) for speed.Saves 1-2KB of flash for SSL applications.
devyte commentedJan 3, 2021
What is the performance impact of this change? |
earlephilhower commentedJan 3, 2021
I wasn't able to measure a consistent performance difference (there is always some wiggle, this change is below that threshold) using the validation example's time-tests. Encryption/BW is unimpacted as well, as far as I can tell (again, always some wiggle). Only the FSM (think of it as the control plane) had The FSM basically was inlining a copy-small-no-of-bytes-from-a-to-b multiple times. Saves a few register stores and call/ret, but it's only done 1-2 times per an entire connection. The FSM itself doesn't have much option for logic optimization, it's a machine-generated, Forth-like interpreter with a byte-byte processor so each So, AFAICT, it's ~0 perf impact and 1-2K (depends on your calls) size savings. |
devyte left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Approved!
The FSMs that drive the encryption logic are not performance critical,
but they are very large. Build BearSSL using -Os on them, leaving -O2
everywhere else (i.e. encryption) for speed.
Saves 1-2KB of flash for SSL applications.