|
|
Darren New escreveu:
> Sure. Using C as an intermediate language for another language that's
> basically C-ish is probably a good idea.
Scheme is very unlike C, both obviously in syntax but also in semantics:
no low-level type declares, higher-order functions receiving or
returning functions, unlimited lexical scoping, unrestricted
higher-order continuations. Syntatic abstraction doesn't even come into
play for semantics as it's processed before being compiled to C.
Still, C is a very preferred target for Scheme fast code generators.
Many translation techniques have matured and proven very useful in using
C as intermediate language.
> I was merely arguing that the
> idea that "my language runs as fast as C code" is not obviously true
> from the fact that it uses C as an intermediate language. Using C as an
> intermediate language doesn't make it trivial to run as fast as
> hand-rolled C.
Not obvious, yes. It works by using C as assembly rather than as a
third generation high-level language as it once was. They use many
dirty tricks that no one using C to directly write programs in would
think of, like agressive loop unrolling and optimization and constant
folding before generating any C code. Much of the C "code" is actually
C preprocessor macros.
Yes, it will never be as fast as C obfuscated and cryptic code written
by hand by a hacker, but the point is not that: it is to write very
high level code that still performs quite favorably to low-level C as
assembly.
--
a game sig: http://tinyurl.com/d3rxz9
Post a reply to this message
|
|