On 12/9/2015 9:35 PM, brendan wrote:
On Wednesday, December 9, 2015 at 6:22:54 PM UTC-5, gneuner2 wrote:
> I *think* Brendan is referring to caching the dispatch path - i.e. once
> you've determined the proper function to call for a set of arguments,
> you cache the arguments (or their relevant characteristics) and the
> resulting function, so if you see them again you don't need to go
> through the whole dispatch process.

Yes, sorry for being unclear. "Inline caching" is apparently the technical 
name, see:

https://en.wikipedia.org/wiki/Inline_caching

My understanding from when I first read about this was that it's used in 
production runtime implementations, but I'm not positive about that (it was a 
while ago).

Method lookup caches are used in single dispatch languages - most often in message based object implementations where the set of messages is subject to change at runtime. The relevant point from the article:

   Inline caching is especially useful for dynamically typed
   <https://en.wikipedia.org/wiki/Dynamic_typing> languages where most
   if not all method binding happens at runtime and where virtual
   method tables <https://en.wikipedia.org/wiki/Virtual_method_table>
   often cannot be used.

I would question that they are used frequently. I can only think of few language implementations that I am certain use them. And none of these languages offer multimethods.

Tables can be, and are used for late binding - but they are not necessarily the same as the per-class vtables in C++. Most dynamic languages use a generic call sequence that indirects calls through linkage tables, and the method cache (if any) is checked before searching the table. However, I have never seen such caching done at a call site ... unless they consider the "call site" to be the dispatch point rather than the invocation of dispatch in the program code. It technically is correct but is not what most people mean by "call site".

Anyway, CLOS multimethod dispatch is table based in most current implementations. I'm not aware that any of them use an additional method cache.

George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to