#1436 What do I do when I do need a long[] for fast signal processing?

gugussee Fri 4 Mar 2011

Sometimes in Java we do need to use a huge, big, fat, primitives arrays. For example I've worked on a software where the only reason why we could compete with equivalent software written in C was that Java was "low-level enough" for our needs, by giving us access to a huge, fat, ugly, long[].

I'm very interested in Fantom and I was wondering: can I use Fantom to do something like efficient signal processing or implementing efficiently an encryption algorithm?

In other words, is it possible to have something close to a long[], without suffering from the abysmal performance hit an object wrapper around every single long would incurr (like, say, with a List<Long> in Java) and without too many method-calls (and verification?) hits?

brian Fri 4 Mar 2011

We do a lot of low-level stuff like that using sys::Buf (which is essentially a nice wrapper around byte[]).

If you really need to use long[] exactly, you can use fanx.interop::LongArray.

gugussee Fri 4 Mar 2011

Hi brian,

thanks a lot, just quickly read these two links: I'm going to try Fantom out one of these days :)

tactics Mon 7 Mar 2011

If your signal processing is really CPU intensive, there's always the possibility of dropping down into Java through the FFI, just as you would drop into C from a scripting language. The Fantom FFI is pretty easy to use.

Login or Signup to reply.