|
|
Darren New escreveu:
> Contrast with something that generates machine code natively, which
> might output code that your C compiler would never output, for example.
>
> If your front-end outputs C, you're never going to out-perform the C
> code it generates. If your C compiler can't take advantage of the GPU to
> do math or can't hook into interrupt vectors directly or ..., then your
> language isn't going to do better.
It is very difficult to write compilers that generate optimized native
code as good as the ones already provided by mature C compilers that
have been around for ages.
Larceny is the only free Scheme implementation that tries to generate
native code directly (or .NET bytecodes) and is written by one of the
top Scheme implementers around. It generates native code that is a good
deal faster than JIT-compiled like in mzscheme or ikarus, but still much
slower ones by Gambit or Stalin, both of which generate C code.
BTW, if you look at C code so produced, it hardly looks like C at all.
Like:
___DEF_OLD_SYM_GLO(___S_pcase9,___G_pcase9)
___DEF_OLD_SYM_GLO(___S_peek_2d_char,___G_peek_2d_char)
___DEF_OLD_SYM_GLO(___S_peek_2d_eof_3f_,___G_peek_2d_eof_3f_)
___DEF_OLD_SYM_GLO(___S_peer,___G_peer)
___DEF_OLD_SYM_GLO(___S_permanent_2d_close,___G_permanent_2d_close)
___DEF_OLD_SYM_GLO(___S_permissions,___G_permissions)
from Gambit. Truly insane. But the good thing is that code is now
portable to different 32-bit platforms as long as there's a C compiler.
Would it be worth the pain generating assebly not as optimized as a C
compiler?...
--
a game sig: http://tinyurl.com/d3rxz9
Post a reply to this message
|
|