anchao opened a new pull request #3259:
URL: https://github.com/apache/incubator-nuttx/pull/3259


   
   ## Summary
   
   libc/string: Use Byte-Shift algorithm for very long needles 
   
   Reference here:
   https://github.com/taleinat/byteshift_strstr
   
   Signed-off-by: chao.an <anc...@xiaomi.com>
   
   ## Impact
   
   ## Testing
   
   strstr(3) performance degrade in the case of long needles, (e.g curl/mbedtls 
parse the CA certificates)
   
   CA certificates:
   https://curl.se/docs/caextract.html
   
   curl mbedtls_x509_crt_parse_file: 
   
https://github.com/curl/curl/blob/3266b35bbe21c68dea0dc7ccd991eb028e6d360c/lib/vtls/mbedtls.c#L304
   
   strstr:
   
https://github.com/ARMmbed/mbedtls/blob/e93095fe6bdc99818f71197e808d20244cd1e41a/library/x509_crt.c#L1461-L1464
   
https://github.com/ARMmbed/mbedtls/blob/e93095fe6bdc99818f71197e808d20244cd1e41a/library/pem.c#L246-L251
   
   In the default implementation, curl's CA certificate parse will last about 4 
- 4.5 *Seconds* in multiple strstr(3) processing, after optimization, reduced 
to 80 milliseconds.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to