This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] nreverse


On Tue, 2003-04-15 at 12:29, Devang Patel wrote:
> 
> On Tuesday, April 15, 2003, at 10:58 AM, Mark Mitchell wrote:
> 
> > And if we're going to start factoring NULL tests out of functions to
> > avoid function call overhead, the the right way to do that is:
> >
> >   bool predicate_f (tree);
> >
> >   #define predicate(T) ((T) ? predicate_f ((T)) : false)
> >
> > or the equivalent version with an inline function.
> >
> 
> hmm... this reminded this quick hack I have in my local sources since 
> last
> couple of months. This reduces nreverse () call from 14129 to 4405 calls
> for hello world in C++ using std::cout. It reduces nreverse () calls 
> from
> 32090 to 11370 on larger test case.

The hash table change is not OK without further justification.

The nreverse_fn change is OK -- but you need comments for the macro, and
they need to mention that it evaluates T more than once.  And you need
to check the existing calls to make sure that's OK; some existing calls
might need to call nreverse_fn instead.

With those caveats, the patch is OK.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]