Data.Colour.FastFloor
Description
This module shouldn't need to exist. It exists because
GHC's implementation of floor is currently (6.10.3)
very slow. See the following tickets:
- fast_floor :: Double -> Word8
Documentation
fast_floor :: Double -> Word8Source
This is a special version of the regular floor function.
It works by directly calling the low-level internal GHC
primitives, and thus is as fast as you'd expect for such
a trivial operation.
(The standard floor function does something crazy like
converting a Double to a numerator/denominator Integer
pair and then computing the integer part of the quotient as
an Integer, then truncating that to a Word8. Which,
obviously, is ludicrously slow.)
Hopefully one day the need for this low-level hackery will disappear.