Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object Oriented Programming
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00134380
Message ID:
00139051
Vues:
37
>Did you know that a method call in VFP is up to seven times slower than a function call?

I did _not_ know that, as our Johnny Carson was wont to say. :)

>No-one complains about that and the only overhead in my sample code is the dispatcher, it runs quite quickly. Sure, it's slower than pure procedural programming, but compared with VFP it's not that slow at all.

Guess I'd have to see some timing tests to determine that. Especially since you're dispatching twice: once to find the "object" and once to do a string compare to find what "method" to invoke. All in interpreted code, not in the kernel. Macro substitution is notoriously slow.

>And slow to program? I don't think so. As I said, mot of it can be done with a few CEE macros. All you enter is DEFCLASS and you get a template for the dispatch. Than maybe enter PEM, enter the name of the method, and you get a Case branch for a method.

Every time you add a new method, you have to change every derived "dispatch table" (and hope you remember where they all are). That alone (and the chances for error in so doing) would make me shy of this technique. You have to push five arguments on the stack on every call, even if the function takes no arguments. And you're out of luck if you have ten arguments.

But the proof is in the pudding: has anyone ever actually programmed this way? :)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform