[Haskell-cafe] Ridiculously slow FFI, or cairo binding?
ekirpichov at gmail.com
Wed Nov 2 10:51:05 CET 2011
I suspected that the issue could be about unsafe foreign imports - all
imports in the cairo bindings are "safe".
I compiled myself a version of cairo bindings with the "rectangle" and
"fill" functions marked as unsafe.
Unfortunately that didn't help the case at all, even though the core
changed FFI calls from "__pkg_ccall_GC" to "__pkg_ccall". The performance
stayed the same; the overhead is elsewhere.
On Wed, Nov 2, 2011 at 1:31 PM, Claude Heiland-Allen <claude at goto10.org>wrote:
> On 02/11/11 09:17, Eugene Kirpichov wrote:
>> I've got two very simple programs that draw a very simple picture using
>> cairo, doing a couple hundred thousand of cairo calls.
>> One program is in C++. The other is in Haskell and uses the cairo library
>> The C++ program completes in a fraction of a second, the Haskell program
>> takes about 7-8 seconds to run. They produce exactly the same output.
>> What could be at fault here? Why are the cairo bindings working so slow?
>> suppose there isn't too much cairo-specific stuff here, perhaps it's a
>> general FFI question?)
> I filed a bug report about this some months ago, having noticed similar
> gtk2hs ticket #1228 "cairo performance is very bad"
> My conclusion was that it isn't FFI being slow, but some other reason,
> possibly too much redirection / high level fanciness in the implementation
> of cairo bindings that the compiler can't see through to optimize
> aggressively, or possibly some Double / CDouble / realToFrac rubbishness.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe