[antlr-interest] How to optimize this piece of C/C++ code

chain one chainone at gmail.com
Thu Feb 5 18:15:12 PST 2009


void NUEDataManager::ParseOneEntry(const char* entry_start)
{
    p_semi = strchr(entry_start,';');
    assert(p_semi);


    m_input  =
antlr3NewAsciiStringInPlaceStream((pANTLR3_UINT8)entry_start,p_semi-entry_start+1,NULL);
    m_lex    = StepDataEntryLexerNew(m_input);
    m_tokens = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT,
TOKENSOURCE(m_lex));
    m_parser = StepDataEntryParserNew(m_tokens);

    m_parser  ->entry(m_parser,id);

    m_parser->free(m_parser);
    m_tokens->free(m_tokens);
    m_lex->free(m_lex);
    m_input->close(m_input);
}


the ParseOneEntry function will be called more than 1000000 times in most
cases.
So I am wondering if it is feasible to get this piece of code improved
further?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090206/619169ef/attachment.html 


More information about the antlr-interest mailing list