While profiling InclusionRewriter, it was found that counting lines was so slow that it took up 20% of the processing time. Surely, calling memcmp() of size 1 on every substring in the window isn't a good idea. Use StringRef::find() instead; in the case of N=1 it will forward to memcmp which is much more optimal. For 2<=N<256 it will run the same memcmp loop as we have now, which is still suboptimal but at least does not regress anything. Differential Revision: https://reviews.llvm.org/D133658
18 KiB
18 KiB