Faster tag parser

I've encountered slow subtitle rendering due to slow parse_tag(). This patch attempts to fix that issue.