Re: Difference in performance for accessing structs vs basic variables

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

 



Marcus Clyne skrev:
> I am assuming that the 'exact' (that is relative in the stack)
> location of the str.len is used, rather than an offset from the
> beginning of the 'str' variable, with the position of str.len
> calculated at runtime each time it's accessed.  Is this correct?

That is correct as far as I know. The offsets inside a struct are known
at compile time, so nothing like that should be calculated at runtime.
You could check the assembly output of the 2 versions to be certain.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux