[Haskell-cafe] Ridiculously slow FFI, or cairo binding?

Daniel Fischer daniel.is.fischer at googlemail.com
Wed Nov 2 13:27:46 CET 2011


On Wednesday 02 November 2011, 10:19:08, Eugene Kirpichov wrote:
> I forgot to specify my environment.
> 
> Windows Server 2008 R2 x64, ghc 7.0.3.
> 
> However, I observed the same speed differences on a 64-bit ubuntu with
> ghc 6.12 - I profiled my application with cairo-trace, and
> cairo-perf-trace drew in a fraction of a second the picture that my
> Haskell program spend a dozen seconds drawing.

Just FYI,

$ uname -a
Linux linux-v7dw.site 2.6.37.6-0.7-desktop #1 SMP PREEMPT 2011-07-21 
02:17:24 +0200 x86_64 x86_64 x86_64 GNU/Linux

$ g++ -O3 -o csurf surf.cc -I/usr/include/cairo -cairo
$ time ./csurf 

real    0m0.126s
user    0m0.119s
sys     0m0.006s
$ ghc-7.0.4 -O2 hssurf.hs 
[1 of 1] Compiling Main             ( hssurf.hs, hssurf.o )
Linking hssurf ...
$ time ./hssurf 

real    0m5.857s
user    0m5.840s
sys     0m0.011s
$ ghc -O2 hssurf.hs -o hssurf2
[1 of 1] Compiling Main             ( hssurf.hs, hssurf.o )
Linking hssurf2 ...
$ time ./hssurf2 

real    0m0.355s
user    0m0.350s
sys     0m0.005s

(fromRational . toRational) is still slow, but nowhere as slow as it used 
to be.



More information about the Haskell-Cafe mailing list