Calling API functions dynamically?

  • Thread starter Thread starter Usenet User
  • Start date Start date
He would not be alone.
Letting VB have to follow a long list of
"Thing.anotherThing.yetAnotherThing." waste time cycles that can be
replaced with one With./ end With.

you're thinking like a typist and not like a compiler
 
You're over-thinking what a compiler can /safely/ do.

How so, Bob? I didn't say a thing about what a compiler can do, safely or
otherwise. My comment was about what a compiler CAN'T do, namely, save you
clock cycles when you use a WITH ... END WITH construct. Some may like the
convenience of saving a few keystrokes but it has no impact at all on
efficiency of the machine code emitted.

L
 
Liz said:
...



How so, Bob? I didn't say a thing about what a compiler can do,
safely or otherwise. My comment was about what a compiler CAN'T do,
namely, save you clock cycles when you use a WITH ... END WITH
construct. Some may like the convenience of saving a few keystrokes
but it has no impact at all on efficiency of the machine code emitted.

Oh, dear -- not this again. There should never be threads that cross ..NET <-> .NOT boundaries because there's no telling where you're coming from.

Bob is coming from VB6, where With...End can definitely save cycles over naively accessing properties one at a time. It does this by holding a temporary reference to an object in memory. Maybe the compiler could do the work, but it doesn't. You could also create a temporary object yourself, but why bother when you have this handy construct?

In VB6,

With MyObject.Yardarm
.Farkle = 54
.Singed = True
.Unhatting = Argyle
.Rey = Tal
End With

....is measurably faster than:

MyObject.Yardarm.Farkle = 54
MyObject.Yardarm.Singed = True
MyObject.Yardarm.Unhatting = Argyle
MyObject.Yardarm.Rey = Tal

I have no idea what the situation in .NET is.
 
Jim Mack said:
With MyObject.Yardarm
.Farkle = 54
.Singed = True
.Unhatting = Argyle
.Rey = Tal
End With

...is measurably faster than:

MyObject.Yardarm.Farkle = 54
MyObject.Yardarm.Singed = True
MyObject.Yardarm.Unhatting = Argyle
MyObject.Yardarm.Rey = Tal

But With it is measurably slower than creating an object variable.

Michael
 
It is?
Paul Clement said:
¤ ¤ > Well, the names are different, unfortunately. Also, I'm talking about
¤ > VB.NET (i.e., read - CLR), not VB6.
¤
¤ Then you aren't talking about VB no matter how misleadingly MS has named
¤ their product

It's certainly not VB 6.0, no, despite the fact that it still uses a
version of the BASIC language.

It does? I thought it just used some of the same keywords as BASIC.

Ok, I suppose, like Java is a 'version of C'
 
¤ >
¤ > It's certainly not VB 6.0, no, despite the fact that it still uses a
¤ > version of the BASIC language.
¤
¤ It does? I thought it just used some of the same keywords as BASIC.
¤

Uses most of them from my experience.

¤ Ok, I suppose, like Java is a 'version of C'

You're asking the wrong person. ;-)


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top