Re:What is Symbolic Computation?
by white-flame on Thursday June 30, 2016 @04:40AM
(#12007310)
For others reading, it's making a call in both cases because "integer" is not a native machine type. Integers are unbounded and include all big integers as well.
The various float types and fixnum (machine register width integer) would compile down to machine code multiplication instructions without function calls, if declared or inferred that the inputs (and output in the fixnum case) are of those types, and the safety option is reduced. (In SBCL)
The `declare` thing is common lisp is a bit poorly understood in general:
`declare` is not a promise the compiler makes to you to only accept the declared type.
`declare` is actually a promise YOU make to the compiler to only pass the declared type as parameter. Knowing this, the compiler can activate some optimization (it's an integer? i guess i can skip type detection then).
But let's get real:
The difference is clear: instead of just performing the multiplication, the generated code must CALL a generic function. With all of the cost of function calling (memory access time and stuff).