Optimizing compiler
Factor handbook » The implementation

Prev:Source files
Next:Batch error reporting


Factor includes two compilers which work behind the scenes. Words are always compiled, and the compilers do not have to be invoked explicitly. For the most part, compilation is fully transparent. However, there are a few things worth knowing about the compilation process.

The two compilers differ in the level of analysis they perform:
The non-optimizing quotation compiler compiles quotations to naive machine code very quickly. The non-optimizing quotation compiler is part of the VM.
The optimizing word compiler compiles whole words at a time while performing extensive data and control flow analysis. This provides greater performance for generated code, but incurs a much longer compile time. The optimizing compiler is written in Factor.

The optimizing compiler also trades off compile time for performance of generated code, so loading certain vocabularies might take a while. Saving the image after loading vocabularies can save you a lot of time that you would spend waiting for the same code to load in every coding session; see Images for information.

Most code you write will run with the optimizing compiler. Sometimes, the non-optimizing compiler is used, for example for listener interactions, or for running the quotation passed to call(.
Compiler errors
Compiler specialization hints
Calling the optimizing compiler
Compiler implementation