Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Why are objects slower than procedural subs/data structs?

by Fletch (Bishop)
on Feb 03, 2004 at 18:16 UTC ( [id://326276]=note: print w/replies, xml ) Need Help??


in reply to Why are objects slower than procedural subs/data structs?

Method dispatch overhead. When you say foo( $a ) whatever foo in the current scope is called dirrectly. When you say $obj->bar( $b ), then perl has to check what $obj is (a scalar holding a blessed ref? a class name), then try and call Whatever::bar, and if that doesn't work try SuperWhatever::bar . . .

Granted there's some caching done, but it's more than just a simple subroutine call.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-24 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found