
Hello Yhc'ers, With the correction of bug #18 http://code.google.com/p/yhc/issues/detail?q=&can=2&id=18 I have been able to use Yhc to run a number of my "serious" toy programs, solving important problems like SuDoku puzzles or finding prime factors of large integers. Congratulations, this is most satisfactory. I have a simple benchmark that I have run many times, mostly to compare the performance of different machines. The benchmark consists of running a single program t3 compiled using GHC and measure its CPU usage. This program performs some rather long-winding computations involving large (35-70 decimal digit) numbers that conclude in discovering the second-largest prime factor 1963506722254397 of the "repunit" R[43] = (10^43-1)/9 = 111...(total of 43 1's)...1. On a slow machine that I have used a lot, this takes about 3.5 minutes. On a fast machine, it takes less than 3 seconds. But t3 can, of course, also be used to compare different Haskell implementations on the same machine. So, I have run the following script on my PPC Mac OS X 10.4: #!/bin/sh # t3timing1.sh: Timing t3.hs using GHC, Hugs, Yhc # 2007-Feb-13 19.11 / TN do_ghc () { echo $0: GHC $* time ghc-inplace --make t3.hs $* time ./t3 rm *.hi *.o t3 } ghc-inplace --version time echo :q | ghc-inplace --interactive t3 time echo main | ghc-inplace --interactive t3 do_ghc -O0 do_ghc -O1 do_ghc -O2 time echo :q | hugs t3 time echo main | hugs t3 time yhc t3 time yhi Main rm *.hi *.hbc Essentially, this runs t3 using 4 variants of GHC-support (interpreted and -O0..2) and a single variant of each of Hugs and Yhc. The output, with some non-essentials left out, is: The Glorious Glasgow Haskell Compilation System, version 6.7.20070209 ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.7.20070209, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. [ 1 of 47] Compiling FtdBase ( FtdBase.hs, interpreted ) ... [47 of 47] Compiling Main ( t3.hs, interpreted ) Ok, modules loaded: ... *Main> Leaving GHCi. real 0m25.956s user 0m20.449s sys 0m1.029s ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.7.20070209, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... linking ... done. [ 1 of 47] Compiling FtdBase ( FtdBase.hs, interpreted ) ... [47 of 47] Compiling Main ( t3.hs, interpreted ) Ok, modules loaded: ... *Main> Loading package haskell98 ... linking ... done. t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297,[(77,ECUndefined {ecd = 1963506722254397})])") *Main> Leaving GHCi. real 2m4.864s user 1m55.500s sys 0m2.099s t3_timing1.sh: GHC -O0 [ 1 of 47] Compiling FtdBase ( FtdBase.hs, FtdBase.o ) ... [47 of 47] Compiling Main ( t3.hs, t3.o ) Linking t3 ... real 1m7.438s user 0m52.395s sys 0m4.777s t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297,[(77,ECUndefined {ecd = 1963506722254397})])") real 0m22.225s user 0m21.242s sys 0m0.348s t3_timing1.sh: GHC -O1 [ 1 of 47] Compiling FtdBase ( FtdBase.hs, FtdBase.o ) ... [47 of 47] Compiling Main ( t3.hs, t3.o ) Linking t3 ... real 1m30.559s user 1m15.897s sys 0m5.035s t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297,[(77,ECUndefined {ecd = 1963506722254397})])") real 0m20.557s user 0m19.279s sys 0m0.283s t3_timing1.sh: GHC -O2 [ 1 of 47] Compiling FtdBase ( FtdBase.hs, FtdBase.o ) ... [47 of 47] Compiling Main ( t3.hs, t3.o ) Linking t3 ... real 1m35.578s user 1m20.963s sys 0m5.178s t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297,[(77,ECUndefined {ecd = 1963506722254397})])") real 0m20.122s user 0m19.182s sys 0m0.306s __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: 20070105 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Main> [Leaving Hugs] real 0m3.336s user 0m1.609s sys 0m0.924s __ __ __ __ ____ ___ _________________________________________ || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2005 ||---|| ___|| World Wide Web: http://haskell.org/hugs || || Bugs: http://hackage.haskell.org/trac/hugs || || Version: 20070105 _________________________________________ Haskell 98 mode: Restart with command line option -98 to enable extensions Type :? for help Main> t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297,[(77,ECUndefined {ecd = 1963506722254397})])") Main> [Leaving Hugs] real 5m45.012s user 5m37.656s sys 0m3.116s Nothing derived for Id 424 at nopos Nothing derived for Id 451 at nopos Nothing derived for Id 335 at nopos Compiling IntMath ( IntMath.hs ) ... Compiling Main ( t3.hs ) real 1m5.848s user 1m0.264s sys 0m1.894s t3: 2007-Feb-13 20.08 t3I_20: fecFactorList [6..105] r43r 1300 4300 1 t3I_20: (1963506722254397,"(1297,4297, [(77,ECUndefined{ecd=1963506722254397})])") real 5m36.540s user 5m29.788s sys 0m2.544s From this, -O2 GHC execution is about 19 seconds, Hugs execution is 5 minutes and 41 seconds (341 seconds) (including compilation, about 3 seconds), and Yhi execution is 5 minutes and 31 seconds (331 seconds). Overall: For this program (t3), Hugs and Yhc execution times are comparable. Compiled GHC -O2 is 17 times faster. Best regards Thorkil