id,summary,reporter,owner,description,type,status,priority,milestone,version,resolution,keywords,cc
17,folds for unboxed vectors are slow.,Khudyakov,,"I found that fold based functions which operate on unboxed vectors are much slower (~7-50 times) than functions which operate on generic vectors. Benchmark is in attachment.

{{{
-- Slow function
mean :: U.Vector Double -> Double
mean = ...
-- Fast function
mean' :: (G.Vector v Double) => v Double -> Double
mean' = ...
}}}

Here is profiling results. '''U''' column is for mean, '''G''' is for mean'.
{{{
       | U(ms) | G(ms) |
foldl  | 47.3  |  1.08 |
foldl' |  6.54 |  1.09 |
foldr  | 44.3  |  1.99 |
fodlr' |  7.44 |  1.02 |
}}}
It looks like that monomorphic variant isn't properly optimized. Results are consistent between GHC6.10.4 and GHC6.12.1.
",defect,closed,major,,0.6,invalid,,
