Ticket #17 (closed defect: invalid)

Opened 3 years ago

Last modified 3 years ago

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

Changed 3 years ago by Khudyakov

  • status changed from new to closed
  • resolution set to invalid

Trac refused to add an attachment and I accidentally reported this bug twice

Note: See TracTickets for help on using tickets.