Reputation: 53531
How do I declare the types of the parameters in order to circumvent type checking?
How do I optimize the speed to tell the compiler to run the function as fast as possible like (optimize speed (safety 0))?
How do I make an inline function in Scheme?
How do I use an unboxed representation of a data object?
And finally are any of these important or necessary? Can I depend on my compiler to make these optimizations?
thanks, kunjaan.
Upvotes: 3
Views: 363
Reputation: 24409
If you want to help out the compiler, consider reducing top level definitions where possible. If the compiler sees a function at top-level, it's very hard for it to guess how that function might be used or modified by the program. If a function is defined within the scope of a function that uses it, the compiler's job becomes much simpler.
There is a section about this in the Chez Scheme manual: http://www.scheme.com/csug7/use.html#./use:h4
Apparently Chez is one of the fastest Scheme implementations there is. If it needs this sort of "guidance" to make good optimizations, I suspect other implementations can't live without it either (or they just ignore it all together).
Upvotes: 2
Reputation: 29556
Upvotes: 5