discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Switching to libobjc2


From: Konstantin Osipov
Subject: Re: Switching to libobjc2
Date: Mon, 2 Jul 2012 19:41:49 +0400

* David Chisnall <theraven@sucs.org> [12/06/28 12:48]:
> As the author of the GNUstep runtime, I think that's great. On
> x86[-64] and ARM it now implements the objc_msgSend() dispatch
> mechanism.  This is enabled by default if you compile with clang
> on *BSD, and optionally on Linux.  When using this mechanism,
> message sending is very fast.  When using the traditional
> two-stage lookup, it's slightly slower than the GCC runtime
> because it also supports a few other cases (specifically, small
> objects hidden inside pointers) which the GCC runtime does not
> support.

Is it TYPE_DEPENDANT_DISPATCH? I checked and we are compiling
with it turned on.

> You may want to make use of this support in your code.

How do I use a slow object slot for my own objects? 

In particular we have a central object in the system, called
Request, which is created and dispatched for every user request.

Simply going away from Objective C dispatch to a C function call
for this object gives 16% overall performance boost. 

We have now tried the libobjc2 runtime, and discovered that it is
even slower in our case than the GCC runtime (a drop from average
of 350k rps to 330k rps, TYPE_DEPENDENT_DISPATCH is on).

There is a slight chance that we're not compiling it correctly
though.

> There are also some LLVM optimisations shipped with the runtime
> that can do things like cache method lookups in loops, which can
> make the cost of message sending even cheaper.
> 
> If you want to catch C++ exceptions, then you have two choices.
> The simplest is to compile your code as Objective-C++.  This
> will then use the Objective-C++ personality function and
> everything should work by magic.  Alternatively, you must
> provide and register a class that is used to pass C++ exceptions
> to Objective-C handlers.  This is required because the GCC ABI
> did not provide a callback into the runtime for disposing of
> exceptions.  The CXXException class in GNUstep does this (you
> can also explicitly catch this class if you want to catch C++
> exceptions from Objective-C code).

Is there anywhere an example for how to box a C++ exception,
if not using GNUSTEP or Foundation framework?

Thank you,

-- 
http://tarantool.org - an efficient, extensible in-memory data store



reply via email to

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