[antlr-interest] [C] my v3 Parser no reuse() slower 20% than v2. With reuse() 2GB leaks, oops.

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Thu Nov 17 22:09:33 PST 2011


On 11/18/11 1:24 AM, "Jim Idle" <jimi at temporal-wave.com> wrote:

Hi Jim,

> You should not be seeing more than a few newPool calls, however, if you
> are building a tree then this may be affecting it.

You mean 

A) my own tree in the parser ?
      no, I do not build. Work ANTLR itself to build AST

B) tree parser?
      but how this affect?
      and everybody need tree parser ...


> The reuse stuff was not built for trees,

Right.  This is why in my Reuse() func you can see that I destroy tree
parser, then it is created again later ...

**************************************************
void SqlParser_v3::ResuseParserObjects(
    const char*        inTextToParse,
    vuint32            inLength )
{
    // -------------------------------
    // TREE PARSER cannot be reused. Destroy it.
    //
    if( mpTreeParser )
    {
        mpTreeParser->free( mpTreeParser );
        mpTreeParser = NULL;
    }
    
    if( mpNodes )
    {
        mpNodes->free( mpNodes );
        mpNodes = NULL;
    }    


    // -------------------------------
    // Reuse other objects
    //
    mpInput->reuse(
        mpInput, 
        (pANTLR3_UINT8) inTextToParse,
        (ANTLR3_UINT32) inLength,
        (pANTLR3_UINT8) "VSQL" );

    mpTokenStream->reset( mpTokenStream );
    mpLexer         ->reset( mpLexer );
    mpParser     ->reset( mpParser );

    ResetOwnData( mpParser );
}


> so you may have to debug this because I won't have time
> to look at new use cases for some time.

Yes, I am going now spend time to see how work  parser->reset() and others
here.

But can you at least give me points, what I should see ?
You set some flags for objects of parser?
 
> I will take out the myriad duplication of function pointers over the new
> year all being well.

This is speed ok. But memory ...


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the antlr-interest mailing list