memoize parseTagSpec

Another attempt at memoizing (sorry for the second PR).