port benchmark from re2, and refactor code for it