NB: Control SBCL optimizations

Note, that you can control how SBCL optimizes certain function (or performs global optimizations).

You can use declare block in functions:

(declare (optimize (safety 3) (debug 3) (speed 0) (space 0)))

This directive means: favor safety and debug over speed and space. The more value is associated with the corresponding directive (i.e. safety, speed, debug or space) the more SBCL compiler values this parameter when it compiles your source.

Debugging priority might be established globally by similar declaration:

(declaim (optimize (safety 3) (debug 3) (speed 0) (space 0)))

SBCL also has internal function that restricts compiler to assign the corresponding weight to the certain compilation parameter:

(sb-ext:restrict-compiler-policy 'debug 3)

Leave a Reply

Your email address will not be published. Required fields are marked *