[antlr-interest] More, Status of C++ backend?

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Jan 2 03:12:24 PST 2008


On 2/1/08 5:28 AM, "Jonathan T" <jonathan.thomas at ca.com> wrote:

> Would it also be fair to say that as Ruslan was saying, it's the copying of
> the string - many times over which really causes the problem.  This is ANTLR
> V2 type behaviour - whereas the new V3 type behaviour is to avoid copying the
> input just to make tokens etc - at least that is what Ter has done for Java, I
> assume the same sort of change occurs for most other back-ends.
> 
> Therefore if the number of string creates/deletes is drastically reduced, then
> what string object/type you use may become a moot point.

I will argue a little, Jonathan.

        new std::string()

Or 
        new another_string()

Do call of TWO allocations

    *  new  => malloc
        constructor
            new for char buffer
    
If we switch to pointers in the some_string_class we still have

    *  new  => malloc
        constructor

I.e. We have remove only 50% of allocations.

-- 
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