Skip to content

Using SBCL's interpreter (and gain some speed, maybe) #52

Description

@vindarel

By default SBCL implements eval by calling the native code compiler.

SBCL also includes an interpreter for use in special cases where using the compiler is undesirable, for example due to compilation overhead.

https://www.sbcl.org/manual/#Interpreter

In other words, SBCL evaluates code given to eval by wrapping the form to be evaluated in a lambda, compiling that, and funcall-ing the compiled function.

So, to use the interpreter:

(let ((sb-ext:*evaluator-mode* :interpret))
    (eval ...))

In the blog post "compilation speed of CL implementations", the author needed to re-build his entire project. He compared the speed of the SBCL's compiler, and the interpreter:

SBCL's compiler SBCL's interpreter
build project 70s 2.5s

=> it's a drastic speed gain, in his case.

It might be that SBCL's extensive optimizations are slowing down the compiler, and aren't needed in the author's case (which is building a static website).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sbclApplies only to SBCL

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions