public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* efficiency
@ 2006-03-17  1:49 Bob Rossi
  2006-03-17  1:58 ` efficiency Brian Budge
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Rossi @ 2006-03-17  1:49 UTC (permalink / raw)
  To: gcc-help

Hi,

I'm currently writing a patch to bison, and can not afford to effect
it's efficiency.

Theoretically, a function in bison uses a local variable named "lfoo" and 
a global variable named "gfoo". I need to pack both of these into a struct,
named "sfoo".

If the function currently uses the variables directly like 'lfoo = 0;',
will changing them to 'sfoo_obj->lfoo = 0;' effect the efficiency of the
program in regards to speed?

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: efficiency
  2006-03-17  1:49 efficiency Bob Rossi
@ 2006-03-17  1:58 ` Brian Budge
  2006-03-17  2:06   ` efficiency Bob Rossi
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Budge @ 2006-03-17  1:58 UTC (permalink / raw)
  To: gcc-help

Hi -

This is not really a gcc question, and it should really be asked
elsewhere... however, it's unlikely that this occasional dereference
will adversely affect performance.

  Brian

On 3/16/06, Bob Rossi <bob_rossi@cox.net> wrote:
> Hi,
>
> I'm currently writing a patch to bison, and can not afford to effect
> it's efficiency.
>
> Theoretically, a function in bison uses a local variable named "lfoo" and
> a global variable named "gfoo". I need to pack both of these into a struct,
> named "sfoo".
>
> If the function currently uses the variables directly like 'lfoo = 0;',
> will changing them to 'sfoo_obj->lfoo = 0;' effect the efficiency of the
> program in regards to speed?
>
> Thanks,
> Bob Rossi
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: efficiency
  2006-03-17  1:58 ` efficiency Brian Budge
@ 2006-03-17  2:06   ` Bob Rossi
  2006-03-17 13:23     ` efficiency Andrew Haley
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Rossi @ 2006-03-17  2:06 UTC (permalink / raw)
  To: Brian Budge; +Cc: gcc-help

On Thu, Mar 16, 2006 at 05:58:29PM -0800, Brian Budge wrote:
> Hi -
> 
> This is not really a gcc question, and it should really be asked
> elsewhere... however, it's unlikely that this occasional dereference
> will adversely affect performance.

OK, where should a question like this be asked? if not the compiler that
does the optimization? I forgot to mention, I only really care about the
efficiency regarding gcc's output.

Bob Rossi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: efficiency
  2006-03-17  2:06   ` efficiency Bob Rossi
@ 2006-03-17 13:23     ` Andrew Haley
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2006-03-17 13:23 UTC (permalink / raw)
  To: Bob Rossi; +Cc: Brian Budge, gcc-help

Bob Rossi writes:
 > On Thu, Mar 16, 2006 at 05:58:29PM -0800, Brian Budge wrote:
 > > Hi -
 > > 
 > > This is not really a gcc question, and it should really be asked
 > > elsewhere... however, it's unlikely that this occasional dereference
 > > will adversely affect performance.
 > 
 > OK, where should a question like this be asked? if not the compiler that
 > does the optimization?

I agree with you, Bob -- it's a perfectly reasonable question.

 > I forgot to mention, I only really care about the efficiency
 > regarding gcc's output.

Well, if you really want to know, use "gcc -S".

Access to a local is something like

        movl    8(%ebp), %eax

and to a global via a pointer

        movl    sfoo, %eax
        movl    4(%eax), %eax
 
Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-03-17 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17  1:49 efficiency Bob Rossi
2006-03-17  1:58 ` efficiency Brian Budge
2006-03-17  2:06   ` efficiency Bob Rossi
2006-03-17 13:23     ` efficiency Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).