aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
866 stars 162 forks source link

Benchmarks: fix detection of supported codecs on x86 #82

Closed htot closed 2 years ago

htot commented 2 years ago

This fixes codec_supported as used by benchmarks. benchmarks forces all codecs built-in at compile time. It does run a test on a test string but this can cause an exception with certain codecs. To this end we factor out cpu capability detection from lib/codec_choose, introduce an additional flag codec flag BASE64_CHECK_SUPPORT, when set this performs cpu capability detection when forced prior to running the test and prevents running the codec if not supported. This ways existing code running the library is not affected.

Signed-off-by: Ferry Toth ftoth@exalondelft.nl

aklomp commented 2 years ago

Thnaks @htot, this is an interesting pull request. I like where this is going and I think it's a good idea to factor out the x86 feature detection bits. I have some ideas about how to enhance this concept and I may come up with a counter-proposal of my own.

htot commented 2 years ago

Sure, I'll wait to see what you come up with before attempting a v2.