{"push_id":717688045,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"bb9d628552d7a91680ef04c08b1f49cee4ada6bf","before":"9d7727737b067c5228f129737046f718d5965659","commits":[{"sha":"bb9d628552d7a91680ef04c08b1f49cee4ada6bf","author":{"email":"4a068946920c47769d700757a47cfec2afcce997@gmail.com","name":"Norbert Thiebaud"},"message":"performance tuning of rtl_ustr_indexOfAscii_WithLength()\n\nlcov over make check showed\n\n 98      4699997 : sal_Int32 rtl_ustr_indexOfAscii_WithLength(\n 99              :     sal_Unicode const * str, sal_Int32 len,\n 100             :     char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()\n 101             : {\n 102     4699997 :     assert(len >= 0);\n 103     4699997 :     assert(subLen >= 0);\n 104     4699997 :     if (subLen > 0 && subLen <= len) {\n 105             :         sal_Int32 i;\n 106    54014537 :         for (i = 0; i <= len - subLen; ++i) {\n 107    51036513 :             if (rtl_ustr_asciil_reverseEquals_WithLength(\n 108    51036523 :                     str + i, subStr, subLen))\n 109             :             {\n 110      205482 :                 return i;\n 111             :             }\n 112             :         }\n 113             :     }\n 114     4494505 :     return -1;\n 115             : }\n\nso\n1/ in 95% of the cases the result is not-found.. _that_ is the hot path\n2/ we are calling rtl_ustr_asciil_reverseEquals_WithLength close to 11 times\n   per call.. (average ~ len - subLen, due to the high miss ratio)\n\nso let's first search for the first byte of the substring\nto optimize the 'miss' case, which is the most common one.\n\nChange-Id: I20ef0821db2ff0db5935dd562844a947a14aff64\nReviewed-on: https://gerrit.libreoffice.org/16763\nTested-by: Jenkins <ci@libreoffice.org>\nReviewed-by: Stephan Bergmann <sbergman@redhat.com>","distinct":true,"url":"https://api.github.com/repos/LibreOffice/core/commits/bb9d628552d7a91680ef04c08b1f49cee4ada6bf"}]}