embedded-websocket icon indicating copy to clipboard operation
embedded-websocket copied to clipboard

Add base64 simd support

Open stevefan1999-personal opened this issue 3 years ago • 2 comments

This will require nightly, so it is disabled by default

stevefan1999-personal avatar Jun 24 '22 15:06 stevefan1999-personal

Hi, thanks for your PR. Can you please let me know what the motivation for adding base64 simd support is? This crate is primarily for no_std use and I see that you have put if behind feature flags which is great but I'd like to know why base64 encoding was slowing things down so much to warrant this added complexity. Did you benchmark it? Base64 encoding is only done when initially setting up the connection. I'm asking because I purposefully chose not to have many dependencies because networking stuff should be easily auditable. Adding dependencies adds surface area for supply chain attack.

ninjasource avatar Jun 25 '22 11:06 ninjasource

@ninjasource using SIMD means smaller code size thanks to instruction level vectorization and this saves a lot of precious space on constrained microcontrollers such as Cortex-M4 where they do have a SIMD execution unit.

Also supply chain attack is very hard for Rust if you properly pin dependencies since version policy of Rust crates are immutable (implying idempotency between each build). Just check well before upgrading your code.

stevefan1999-personal avatar Jun 25 '22 12:06 stevefan1999-personal