Ticket #17 (closed defect: invalid)
folds for unboxed vectors are slow.
| Reported by: | Khudyakov | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Version: | 0.6 | Keywords: | |
| Cc: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
