[jhc] Re: [Haskell] ANNOUNCE: jhc 0.6.0 Haskell Compiler

John Meacham john at repetae.net
Thu Mar 19 04:13:41 EDT 2009


nice, although not quite fair, as jhc always has optimization turned on,
so compiling the others with -O is more appropriate. The 'show' instance
is clearly eating up most of the time in the jhc version, if you look at
the generated C code.

here is main as generated by jhc annotated with the haskell it
cooresponds to in the comments :

static void A_STD
ftheMain(void)
{
   // passing in 100000000 to countdown
   uint32_t v184744394 = 10000000;
   // countdown :: Int -> IO ()
   fW_a__fMain__fl_aMain__countdown_d43_u8:;
   {   sptr_t v261990436 = ((sptr_t)VALUE(v184744394));
       // check if it is zero
       if (0 == v184744394) {
           // putStr "finished"
           fPrelude__IO__putStr(c8);
           // putChar '\n'
           return (void)jhc_utf8_putchar((int)10);
       } else {
           // let s = show x
           wptr_t v100000 = fInstance_a__iJhc__Show__show__default(v261990436);
           sptr_t v118875000 = demote(v100000);
           // putsStr s
           fPrelude__IO__putStr(v118875000);
           // putChar '\n'
           (void)jhc_utf8_putchar((int)10);
           // jump to countdown with x = x - 1
           uint32_t v14532078 = (v184744394 - 1);
           v184744394 = v14532078;
           goto fW_a__fMain__fl_aMain__countdown_d43_u8;
       }
   }
}


        John


--
John Meacham - ⑆repetae.net⑆john⑈


More information about the jhc mailing list