2 Nov 2011 10:51
Re: [Haskell-cafe] Ridiculously slow FFI, or cairo binding?
Eugene Kirpichov <ekirpichov <at> gmail.com>
2011-11-02 09:51:05 GMT
2011-11-02 09:51:05 GMT
Hi Claude,
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 filed a bug report about this some months ago, having noticed similar slowness:Hello,
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
bindings.
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? (I
suppose there isn't too much cairo-specific stuff here, perhaps it's a
general FFI question?)
gtk2hs ticket #1228 "cairo performance is very bad"
http://hackage.haskell.org/trac/gtk2hs/ticket/1228
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.
Claude
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/
------------------------------------------------------------------------------ RSA® Conference 2012 Save $700 by Nov 18 Register now! http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________ Gtk2hs-users mailing list Gtk2hs-users <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtk2hs-users
RSS Feed