<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/e9b284a0003439f67600366eea36ef34"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-12-08T19:02:34"
  subject="Re: [Caml-list] Object-oriented access bottleneck"
  prev="2003/12/b336119b9845b86570c36f5e200c22c7"
  next="2003/12/4ed04b10c434786dfabeb1ac5b6a933d"
  prev-in-thread="2003/12/4ed04b10c434786dfabeb1ac5b6a933d"
  next-in-thread="2003/12/83cb0be3da0d55eea55c4913d5dc051a"
  prev-thread="2003/12/ecaddc19e541a9809560b5db8b55c48d"
  next-thread="2003/12/53de1d81a54124f71e2d3471665fb012"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/0405d2d0e46776c18d8187cc1e8db0ce"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-07T02:39:16"
  subject="[Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/82447d9c9830bab626cd33d41137715f"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-07T02:59:23"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/3bef043c3c8b1d024a522b7968c1655e"
  from="Benjamin Geer &lt;ben@s...&gt;"
  author="Benjamin Geer"
  date="2003-12-07T11:22:07"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/068928e7f339a45342f573b34df00436"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-07T14:12:24"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
<msg 
  url="2003/12/89629aaea615ed0841e41fd89b63c3e1"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-07T18:04:33"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
<msg 
  url="2003/12/11c4c5386a3bce4a54d51a2e9841dca0"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-12-07T10:26:19"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/b9082d28c180dae2adcc644d330d3622"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-07T19:46:25"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/aea7690c5ae1dc3cf7f1ac93954dd44f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-12-08T01:06:47"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/cb58878528d6c6c4c8bc1f70e307263c"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-08T15:08:38"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/25c64c31d216a39f7c1a9b7fc10393dc"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-08T15:42:47"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/24448eaff6f7e9447b75f2bb0fae05c2"
  from="Nicolas Cannasse &lt;warplayer@f...&gt;"
  author="Nicolas Cannasse"
  date="2003-12-09T00:27:02"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/817e19365ada8715c95560fe9bc8c459"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-09T12:10:12"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/3e08ab91fe4e71aa79503c510e5bc9ce"
  from="Olivier Andrieu &lt;andrieu@i...&gt;"
  author="Olivier Andrieu"
  date="2003-12-09T13:17:42"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/53ed62c2429ea4f8799420334d0ea457"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-09T13:53:56"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/70919ec4e1a6ec0e9e44915831c57798"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-08T16:51:11"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/66f13ce473016d9835148ed914297636"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-12-08T18:20:12"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/4ed04b10c434786dfabeb1ac5b6a933d"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-08T19:09:21"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
<msg 
  url="2003/12/e9b284a0003439f67600366eea36ef34"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-12-08T19:02:34"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/83cb0be3da0d55eea55c4913d5dc051a"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-08T20:36:46"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/30111f7048f7f046073a7036d8df76d4"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-08T21:06:18"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
<msg 
  url="2003/12/2fcdfadf2d12989ce7318b8a57465953"
  from="malc &lt;malc@p...&gt;"
  author="malc"
  date="2003-12-08T22:28:35"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/014c876011e3783dfeaee4df9a9dca72"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-07T17:22:59"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/874d67ec980f1675d71aae30479e5186"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-07T18:14:37"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/81f82f284df0b1282309ba984d8511b3"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-07T18:30:19"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/dc39ff38e190a026acbb9b4591886f68"
  from="Abdulaziz Ghuloum &lt;aghuloum@c...&gt;"
  author="Abdulaziz Ghuloum"
  date="2003-12-07T23:50:19"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/d82586dd21630548daff76e5154d68f3"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-08T16:28:43"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
<msg 
  url="2003/12/b336119b9845b86570c36f5e200c22c7"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-08T18:48:21"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/794dd4e65d8ed369f6a8bf00a7fc3953"
  from="Nuutti Kotivuori &lt;naked+caml@n...&gt;"
  author="Nuutti Kotivuori"
  date="2003-12-08T10:18:02"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
<msg 
  url="2003/12/afbc265d71c1874f337802c94c8e954e"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-08T20:51:58"
  subject="Re: [Caml-list] Object-oriented access bottleneck">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
&gt; How much slower is a member function call compared to a non-member 
&gt; function call?  I was given the impression that it was signifigantly 
&gt; slower, but you're making it sound like it isn't.

In the non-member case, it depends very much whether the function
being called is statically known or is computed at run-time.  In the
first case, a call to a static address is generated.  In the latter
case, a call to a function pointer is generated.

Here are some figures I collected circa 1998 on a PowerPC 603 processor:

   type of call              cost of call

inlined function               0 cycles
call to known function         4 cycles
call to unknown function      11 cycles
method invocation             18 cycles

I'm pretty sure that more modern processors have a bigger gap between
the "call to known function" and "call to unknown function" cases.

So, as you can see, method invocation isn't much more expensive than a
call to an unknown function, but is significantly more expensive than
a call to a known function.  

In source-level terms, replacing an object by a record of functions
isn't going to make a major performance difference (the applications
of the functions fetched from the record fall in the "call to unknown
function" case), while getting rid of dynamic dispatch entirely and
just call known functions is a much bigger improvement.

Hope this clarifies the issue.

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

