I noticed that PolyML FFI (v5.6, Foreign structure) 100 times slower than MLton and Haskell FFI, and 10 times than Perl. :-( But why? After all, Haskell uses also libffi...
P.S.
I used buildCall3 ((getSymbol libc "foo"), (cUlong, cString, cUint), cUlong) (0, s, String.size s) and buildCall3 ((getSymbol libc "foo"), (cUlong, cPointer, cUint), cUlong) (0, s, String.size s) for test.
Nick.
The buildCall functions are named that for a reason. Essentially, each time you call buildCall3 ((getSymbol libc "foo"), (cUlong, cString, cUint), cUlong) you are compiling a new interface function. You should only ever call buildCall at the top level or in a structure. You can apply the resulting function as you would an ML function.
There are still inefficiencies in the FFI but I wouldn't expect them to be enormous.
David
On 29/08/2016 09:51, Kostirya wrote:
I noticed that PolyML FFI (v5.6, Foreign structure) 100 times slower than MLton and Haskell FFI, and 10 times than Perl. :-( But why? After all, Haskell uses also libffi...
P.S.
I used buildCall3 ((getSymbol libc "foo"), (cUlong, cString, cUint), cUlong) (0, s, String.size s) and buildCall3 ((getSymbol libc "foo"), (cUlong, cPointer, cUint), cUlong) (0, s, String.size s) for test.
Nick.
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
Oh, I've missed it. Thanks. Now works twice faster. But anyhow 30 times slower than mlton and haskell.
2016-08-29 13:35 GMT+03:00 David Matthews <David.Matthews at prolingua.co.uk>:
The buildCall functions are named that for a reason. Essentially, each time you call buildCall3 ((getSymbol libc "foo"), (cUlong, cString, cUint), cUlong) you are compiling a new interface function. You should only ever call buildCall at the top level or in a structure. You can apply the resulting function as you would an ML function.
There are still inefficiencies in the FFI but I wouldn't expect them to be enormous.
David
On 29/08/2016 09:51, Kostirya wrote:
I noticed that PolyML FFI (v5.6, Foreign structure) 100 times slower than MLton and Haskell FFI, and 10 times than Perl. :-( But why? After all, Haskell uses also libffi...
P.S.
I used buildCall3 ((getSymbol libc "foo"), (cUlong, cString, cUint), cUlong) (0, s, String.size s) and buildCall3 ((getSymbol libc "foo"), (cUlong, cPointer, cUint), cUlong) (0, s, String.size s) for test.
Nick.
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml