Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Virtual method table
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Comparison with alternatives== The virtual method table is generally a good performance trade-off to achieve dynamic dispatch, but there are alternatives, such as [[binary tree dispatch]], with higher performance in some typical cases, but different trade-offs.<ref name=inria-00565627 /><ref>Zendra, Olivier and Driesen, Karel, [http://www.usenix.org/event/jvm02/full_papers/zendra/zendra_html/index.html "Stress-testing Control Structures for Dynamic Dispatch in Java"], pp. 105β118, Proceedings of the USENIX 2nd Java Virtual Machine Research and Technology Symposium, 2002 (JVM '02)</ref> However, virtual method tables only allow for [[single dispatch]] on the special "this" parameter, in contrast to [[multiple dispatch]] (as in [[Common Lisp Object System|CLOS]], [[Dylan (programming language)|Dylan]], or [[Julia (programming language)|Julia]]), where the types of all parameters can be taken into account in dispatching. Virtual method tables also only work if dispatching is constrained to a known set of methods, so they can be placed in a simple array built at compile time, in contrast to [[duck typing]] languages (such as [[Smalltalk]], [[Python (programming language)|Python]] or [[JavaScript]]). Languages that provide either or both of these features often dispatch by looking up a string in a [[hash table]], or some other equivalent method. There are a variety of techniques to make this faster (e.g., [[String interning|interning]]/tokenizing method names, caching lookups, [[just-in-time compilation]]).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)