▲ | skulk 3 days ago | |||||||
FWIW, SBCL is pretty good at optimizing away dynamic type checks if you help it out. Here are some examples under:
First example is a generic multiplication. x and y could be _any_ type at all.
If we disassemble this function, we get the following:
Note that it calls `GENERIC-*` which probably checks a lot of things and has a decent overhead.Now, if we tell it that x and y are bytes, it's going to give us much simpler code.
The resulting code uses the imul instruction.
| ||||||||
▲ | matheusmoreira 2 days ago | parent [-] | |||||||
Can SBCL actually check at compile time that the arguments to fn-t are bytes? I wonder how that works with Lisp's extreme dynamism. Also wondering about the calling convention it uses. | ||||||||
|