
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
On 02/11/11 09:17, Eugene Kirpichov wrote:
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?)
I filed a bug report about this some months ago, having noticed similar slowness:
gtk2hs ticket #1228 "cairo performance is very bad" http://hackage.haskell.org/**trac/gtk2hs/ticket/1228http://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@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Principal Engineer, Mirantis Inc. http://www.mirantis.com/ Editor, http://fprog.ru/