[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] C99 token pasting

From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] C99 token pasting
Date: Sun, 13 Apr 2014 10:42:12 +0800
User-agent: K-9 Mail for Android

On April 12, 2014 9:53:51 PM GMT+08:00, grischka <address@hidden> wrote:
> Good, however note that the mechanism to perform token pasting
> via
>      tcc_open_bf(tcc_state, ":paste:", cstr.size);
> is extremely slow and per se has a good share in making current
> tcc about twice as slow compiling itself compared to 0.9.25.

You mean even without this patch tcc is already slower than for 0.9.26?

> Now I observe that (in self compilation) token pasting happens
> 3113 times,  however the fix (which as the comment suggests is to
> improve certain cases of token pasting) runs similar code additional
> 22669 times.  This raises some questions.

o_O Strange indeed. I see two ways to reduce the cost of this patch. First one 
is to rename next_nomacro1 become next_nomacro2 that would take a char * 
pointer to the buffer to parse for tokens and create a next_nomacro1 wrapper 
for compatibility. Then tcc_open_bf would not be necessary. It could maybe 
allow to remove another tcc_open_bf in the same function.

A second solution would be to create a new function capable of identifying all 
the cases where a space needs to be added. That would duplicate part of what 
next_nomacro1 already know about tokens but should be quite a small function 
and would be faster.

Maybe the first change should be done anyway if choosing the second approach 
for the already existing call to tcc_open_bf in macro_twosharps.

Thanks for monitoring performance regression grischka.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]