discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Header organization of -base & -gui


From: Nicola Pero
Subject: Re: [RFC] Header organization of -base & -gui
Date: Thu, 3 Jul 2003 18:48:22 +0100 (BST)

> >But the Apple runtime performs better on class method invocations - that's
> >a fact (I hoped to have the time to fill the gap at some point, but I
> >never found that time <wishful sigh>). 
> 
> The Apple Runtime uses a cache for Classes and Methods. [...]

The Apple runtime has sort of an inline pointer to the class object for
each class method invocations which is compiled, and has a table of all
those inlined pointers to class objects so that it can fill/update all of
them to point to the right objects when the module is first loaded and
when classes are changed.

The GNU runtime has a simpler architecture - when a class method
invocation is compiled, a call to objc_lookup_class() [or whatever
equivalent function it is] is generated, and the pointer to the class
object is retrieved dynamically by looking up the class by name.  This
does not require any updating of the pointer tables, but incurs a
class-lookup-by-name slowdown each time a class method invocation is
performed.

In the past I have worked hard to speed up the class-lookup-by-name in the
GNU runtime - it's now extremely fast, as it can lookup classes in a
thread-safe manner but without locking.  Still, the Apple runtime does not
do the class-lookup-by-name at all, so their class method invocation
remains faster, even if the gap is not as huge as it used to be.

Filling the gap requires modifying the compiler to generate some sort of
class pointer table and modifying the runtime to keep it updated.  It
would be a major backwards-incompatible change, but worth it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]