What's the best way for such strings match?

I want to analyze a message's type for best performance, the message is begin with constant string and one space followed. The constant strings belongs to one known list of string array, like "CUT", "GET", "LOGIN" ... So I do not like to memcmp(data, "GET", 3) thing repeatedly which is bad for performance. I wonder is there any better solution. Maybe I can compile this constant string arrays into a DFA for quick string match, but I do not know how to do it, and is there any other better solution? Possible use lexer to do this?
Did you mean memcmp for memcpy ?

以上就是What's the best way for such strings match?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准