[Top][All Lists]

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

Re: objective-c: how slow ?

From: Malmberg
Subject: Re: objective-c: how slow ?
Date: Sun, 09 Sep 2001 00:44:05 +0200

> But this means that a cached lookup needs to walk through the inheritance 
> graph.
> IC-s cache the target where the method is effectively found so no cycles are
> lost traversing the inheritance graph.

I think you've misunderstood the s-arrays. The s-array for a class
includes all methods for that class, including ones that have been eg.

>    I've made some simplified testing and it turns out that for a 10 deep
> inheritance there is a 6% difference between calling the root and the child
> (the test method returns the incremented argument). In this case IC are ~2.3
> times faster than cached lookup.

In obj-c? That shouldn't be possible, but I'll check.

>   What is the relationship between lookup speed and the number of methods in
> that class ?

The lookup time is constant (for all valid selectors with
implementations after the first call to a method in that class, at

> Why sends to "super" are not directly called, if dynamic inheritance is not 
> used
> ? (A compiler flag perhaps?)
> Is this related to dynamic loading of classes ?

Dynamic loading of categories and poseAs: (I suppose that would qualify
as dynamic inheritance) would break, but it should be possible to add a
compiler flag to do it.

> Perhaps super sends are a good place for ICs (you get 99.99% hits)

100% until you use poseAs:, in which case you'd get 0% hits for that

> Do you think that the increase in code size due to PICs, and its presence in 
> the
> icache, could lead to performance loss comparable to the gain (~2 times) in
> message sends ? (the performance loss can show up somewhere else, that's my 
> worry)

I don't know, and I wouldn't want to try to find out. Things like that
are very tricky to measure.

> Marko

- Alexander Malmberg

reply via email to

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