Re: copymemory basic question
- From: "Jim Mack" <jmack@xxxxxxxxxxxxxxx>
- Date: Fri, 2 Sep 2005 18:21:31 -0400
Tony Proctor wrote:
> Although I haven't checked what the VB compiler generates, 'static'
> variables are generally slower in other languages, and for the same
> basic reason: it's the way they're addressed rather than the way
> they're stored or created.
I'd agree with that assessment and your description of the process except that in the particular case that started this subthread, there were no stack variables at all, which means that the function prolog can be skipped. When this is the case, a single static variable ought to be measurably more efficient in a tiny function like this one. The difference between "mov eax, [staticvar]" and "mov eax, [epb-8]" is insignificant.
(I believe TLS is addressed off FS, which would make that "mov eax, FS:[staticvar]", still a minor hit compared to the call to set up a frame.)
What we don't know is whether VB does indeed skip the prolog/epilog when it can. If it doesn't, then there's no advantage (and a slight disadvantage) to using static locals. From the timings, it sure looks as if it doesn't.
--
Jim
.
- Follow-Ups:
- Re: copymemory basic question
- From: Tony Proctor
- Re: copymemory basic question
- References:
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: Donald Lessau
- Re: copymemory basic question
- From: Jim Mack
- Re: copymemory basic question
- From: Donald Lessau
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: Jim Mack
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: Jim Mack
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: Donald Lessau
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: mscir
- Re: copymemory basic question
- From: Karl E. Peterson
- Re: copymemory basic question
- From: Tony Proctor
- Re: copymemory basic question
- Prev by Date: Re: copymemory basic question
- Next by Date: Re: [slightly OT] the case of the file copy in memory???
- Previous by thread: Re: copymemory basic question
- Next by thread: Re: copymemory basic question
- Index(es):
Relevant Pages
|