[Pharo-project] FFI versus Alien versus NativeBoost (was FFI versus Aloen)

Igor Stasenko siguctua at gmail.com
Fri Jun 10 03:13:27 EDT 2011


On 10 June 2011 06:58, Chris Cunnington <smalltalktelevision at gmail.com> wrote:
>
>>What shortcomings?
>
> I believe there are three outlined in the description on SqueakSource:
>
> "It supports faster call sequence, return code setting, and callbacks to
> execute smalltalk code from the FFI routine."
>
> There's something about that last one: callbacks. I think FFI gives a return
> value, but you can't create a callback.
>
>> NativeBoost is faster than FFI, but NB is a whole other ball-of-wax, and
>> I'd like to support it eventually as well as FFI/Alien.
>
> Another way to look at it is via what Goran said: in terms of age. FFI is
> oldest and most well known. Alien less so. NativeBoost is
> Igor's project and I don't think is widely adopted yet. (Igor's going to
> show up and squish me like a bug, but oh well... )
>
> Igor did say something interesting about FFI versus plugins at Deep Into
> Smalltalk. I believe he wrote Native Boost because he was
> tired of endlessly recompiling vms with plugins. I don't think there is any
> standard vm with NB in it, which means that's exactly
> what you're going to need to do to use NB.
>
Indeed. You need to build own VM. The Last One :)
This is not a problem to me - i can build it in 5 minutes (it builds
about 5 minutes).
But i could understand people who need to learn a lot before doing that.
I plan to add a Hudson job for building VMs with NativeBoost.

The VM-side changes are so small, that i even tempting to propose
adding it to standard VMs.

> FFI has a reputation as something that's a bit touchy.

Well, apart from problems with dynamic library search/load, it is quite solid.
Of course, new multithreaded stuff, added recently by Eliot, needs to be tested.
But for that you need to build different VM :)

> It looks a little easier than it is. The prudent choice would be for you to use
> FFI and curb your ambition away from Alien or NB until later.
>
> There are lots more examples of FFI around than Alien and NB combined.
> OpenSophie has copious code examples.
>
> http://opensophie.org/
>
> I have to stop now. I'm only making it worse for when Igor arrives... must
> go! :p
>

Why?

The FFI implemented in C are more portable. And it is the only choice
for nasty platforms (everyone knows the name ;) where no JIT allowed.
(If you don't wanna do a plugin, of coure).

> Chris
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list