Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9249807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:17:27+00:00 2026-06-18T10:17:27+00:00

Reading some old posts on caml-list I came across the following post by Jacques

  • 0

Reading some old posts on caml-list I came across the following post by Jacques Garrigues: http://caml.inria.fr/pub/ml-archives/caml-list/2007/11/24e8215c8d844b05db58ed3f79c9645f.en.html

The quote that I care about is the following:

Method calls on arbitrary objects can be slow. This is because, due to
subtyping, in some situations there is no way to know where the method
will be in the table, and a binary search has to be done.

Can anybody explain why this is the case? Why exactly subtyping (inheritance I’m assuming in this case) is affecting this? Is this the case for OCaml’s implementation or do other languages suffer from this as well?

Please point me towards further resources regarding this, google has failed me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:17:29+00:00Added an answer on June 18, 2026 at 10:17 am

    Can anybody explain why this is the case?

    With nominal typing each method can be assigned a unique integer at compile time so a virtual function can be found by indexing into an array. With structural typing (as in OCaml) this cannot be done so a hash of the structure (i.e. method name) is used to search for virtual method’s function pointer in a dictionary.

    Why exactly subtyping (inheritance I’m assuming in this case) is affecting this?

    Subtypes are a prerequisite for virtual dispatch.

    Is this the case for OCaml’s implementation or do other languages suffer from this as well?

    Just OCaml’s implementation. In F#, I have used reflection and run-time code generation to achieve the same effect with no such invoke-time performance hit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was recently re-reading some old posts on Eric Lippert's ridiculously awesome blog and
Reading through an old blog post on SAP's community network, I found some instructions
I was reading some old game programming books and as some of you might
When i was reading books to learn C# (might be some old Visual Studio
Can someone give me some advice on this? I am reading in an old
Reading some posts from Jimmy Boggard and wondering - how exactly is it possible
I reading some old ScottGu's blogs on Linq2SQL. Now I'm doing the SPROC part.
I was reading some old articles about debugging, and one of them mentioned the
I'm reading through some old code at work, and have noticed that there are
I've been reading some fairly old books to learn CSS. I've noticed that most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.