Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 515631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:38:53+00:00 2026-05-13T07:38:53+00:00

I want to analyze a message’s type for best performance, the message is begin

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:38:53+00:00Added an answer on May 13, 2026 at 7:38 am

    Take a look at Ragel. And at Mongrel for a real-world use. Though I found the mail parsing example that is enclosed with ragel to be a fun small one to experiment with, too.

    Though, depending on your protocol, just a check on the first byte might get you down to a single subsequent memcmp() just to verify that your verb is indeed the correct one. ‘C’, ‘L’, ‘G’ are all different values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I want to analyze a string using dozens of regular-expressions, could either the
How does one do this? If I want to analyze how something is getting
I am using XmlSpy to analyze an xml file, and I want to get
I want to use mathematica to analyze some data of sqlite? But i don't
I want to analyze MIC audio on an ongoing basis (not just a snipper
I want to analyze a piece of document and build an ontology from it.
Summary: I'm given a series of points in 3D space, and I want to
i want to use profile in Xcode to analyze a opencv programs, and Architectures
i want to analyze a combinational digital circuit. An ASCII file contains the description
I want to analyze a user's input on an InkPresenter to a template. Pseudo-xaml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.