This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] nreverse
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Devang Patel <dpatel at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 15 Apr 2003 12:34:52 -0700
- Subject: Re: [PATCH] nreverse
- References: <870A48DA-6F78-11D7-B33F-0003935AAA26@apple.com>
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