comp.lang.ada
 help / color / mirror / Atom feed
* Performance of static array in record on GNAT / gcc 4.6
@ 2012-12-11 10:53 john
  2012-12-26 15:15 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: john @ 2012-12-11 10:53 UTC (permalink / raw)



Before I do the measurement myself, I wondered whether someone else has already done it. Question: If I pass a record with two large, fixed size arrays with definite values to a procedure as in parameter, is there any performance penalty for accessing elements of the arrays inside the record and procedure as opposed to defining the arrays directly inside the procedure and without wrapping them into a record? 

I'm using GNAT/gcc 4.6 with -O3 and Pragma Optimize (time)

I'm working on a (toy) virtual machine/interpreter where every cycle counts. 

Thanks for any advice!

P.S.: In case someone asks, yes, I'm considering using assembler but for the time being would like to keep it portable.



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

* Re: Performance of static array in record on GNAT / gcc 4.6
  2012-12-11 10:53 Performance of static array in record on GNAT / gcc 4.6 john
@ 2012-12-26 15:15 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2012-12-26 15:15 UTC (permalink / raw)


> Before I do the measurement myself, I wondered whether someone else
> has already done it. Question: If I pass a record with two large,
> fixed size arrays with definite values to a procedure as in
> parameter, is there any performance penalty for accessing elements
> of the arrays inside the record and procedure as opposed to defining
> the arrays directly inside the procedure and without wrapping them
> into a record?

There shouldn't be a difference in performance.  You could verify this
by comparing the generated machine code.



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

end of thread, other threads:[~2012-12-26 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-11 10:53 Performance of static array in record on GNAT / gcc 4.6 john
2012-12-26 15:15 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox