Thank you for the quick responses.
Issue is not only when there are lot of warnings, but also when there is lot of verbose. I use external makefile project, makefiles are generated by CMake with verbose enabled, which is in turn done by Yocto. Turning off verbose is not an option for me.
I think solution is to avoid as many regex matching as possible. Attaching a patch where a token string is added corresponding to each regex where possible in such a way that if the string is not present in the compiler output line, we can be sure that matching will fail.
So check if the token string is present in each line. If not present, don't do regex matching for that regex. If present, do matching as normal.
This significantly improved my build time. I think it will improve build time of normal CB projects projects as well. I've done only limited testing with this.