-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V.enumFromTo is only fast for Int, not Word32 #21
Comments
The problem probably occurs in Data.Vector.Fusion.Bundle.Monadic or Data.Vector.Fusion.Stream.Monad which both define RULES for |
Can you check your benchmarks with the latest vector source? I merged a patch that is supposed to have fixed some RULES. However, I actually don't expect it to work for Word32. I've been looking at the core for a simple test, and the behavior is very strange. There's a rule for Word32 that isn't firing, but the analogous rule fires for many other cases. Int16, Word16, Word64, Int64 and Int32 all work fine, but the Word32 rule does not fire and I'm not sure why. The Word32 and Int32 rules are in the same CPP block, so I don't see what the difference is yet. |
Never mind, I figured out the problem. WORD_SIZE_IN_BITS was undefined due to a missing MachDeps.h include. If you try the latest, you should be getting good performance on all types, I think. If you can confirm, I'll close the bug. |
I would like to, but I cannot figure out how to install vector from git (0.11) and the benchmark at the same time: The benchmark dependencies (criterion) have How can I lift only the upper bounds on |
While my question above persists, I managed to test this by cheating, setting Benchmark results: So this is fixed. |
In https://groups.google.com/d/msg/haskell-cafe/Ms4sKZBwTtw/55CFywSytBQJ I benchmark different alternatives to
forM_ [1..n]
to each other.When looking at
V.forM_ (V.enumFromTo 1 n)
, we noticed that this gets only optimised away to a fast loop when usingVector Int
. WithVector Word32
, it's 5 times slower.What @JohnLato thinks about this:
It would be great if somebody familiar with the vector library could check out whether there are indeed RULES missing for types like Word32.
The text was updated successfully, but these errors were encountered: