str/preg_replace vs manual loop?

Okay, I have a BBCode/widget parser composed of a number of preg_replace, preg_replace_callback, and str_replace functions. It definitely works, but it is a monster. If my understanding is correct, the parser has to loop through a given string upwards of 17 times, plus a few times over some substrings, and we keep adding more and more tags. Most of these involve regex, about 6 are plain string replacements.

This seems inefficient to me. Easy to read, but terribly inefficient. In the future, we have planned a better parser in C that uses a LIFO/stack to only iterate over a given string once, determining what each character might do with a small in-process variable and a large switch/case.

So the question is, should I port that to PHP now? PHP is already, presumably, using its C functions to loop over the string - much faster than writing something in PHP its self. How many C-based loops would it take to become slower than one PHP loop with a couple conditionals, in this context? This is going to take a lot of work, so it’s not exactly something I can just whip up and benchmark real quick.