我最近一直在使用鸡肉方案,我发现它真的很好,有人建议 chez 方案是最快的方案实施。所以我想尝试一下,但我不确定如何从 chez 创建编译的二进制文件,就像在鸡计划中一样。
2 回答
正如 Sylwester 已经提到的 fasl 二进制文件,但是这个解决方案仍然需要分发一个 chez 方案解释器。产生可分发二进制文件的更有趣的解决方案是 chez-exe https://github.com/gwatt/chez-exe
Chez has a JIT and you can compile files into fasl-like files that you can run just like source files.
From Using Chez Scheme:
Chez Scheme compiles source forms as it sees them to machine code before evaluating them, i.e., "just in time." In order to speed loading of a large file or group of files, each file can be compiled ahead of time via compile-file, which puts the compiled code into a separate object file. For example, (compile-file "path") compiles the forms in the file path.ss and places the resulting object code in the file path.so. Loading a pre-compiled file is essentially no different from loading the source file, except that loading is faster since compilation has already been done.
When compiling a file or set of files, it is often more convenient to use a shell command than to enter Chez Scheme interactively to perform the compilation. This is easily accomplished by "piping" in the command to compile the file as shown below.
echo '(compile-file "filename")' | scheme -q