-
Notifications
You must be signed in to change notification settings - Fork 50
List Functor: mix unrolled and reverse map #135
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8d3f8e5
initial benchmarks for List.map
matthewleon 39bb1c3
List Functor: mix unrolled and reverse map
matthewleon 87c5a16
style tweak
matthewleon 677342a
test stack-safety of strict map
matthewleon bc5d4aa
lower unrolled map iteration limit
matthewleon cadf481
restore un-exported functions from Data.List.Types
matthewleon 4fbe0ca
add failing map test
matthewleon e510520
fix a logic error in List.map chunkedRevMap
matthewleon 5e653a9
make map stack safe(r) again
matthewleon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| module Bench.Data.List where | ||
|
|
||
| import Prelude | ||
| import Control.Monad.Eff (Eff) | ||
| import Control.Monad.Eff.Console (CONSOLE, log) | ||
| import Performance.Minibench (bench) | ||
|
|
||
| import Data.List as L | ||
|
|
||
| benchList :: Eff (console :: CONSOLE) Unit | ||
| benchList = do | ||
| log "map" | ||
| log "---" | ||
| benchMap | ||
|
|
||
| where | ||
|
|
||
| benchMap = do | ||
| let nats = L.range 0 999999 | ||
| mapFn = map (_ + 1) | ||
| list1000 = L.take 1000 nats | ||
| list2000 = L.take 2000 nats | ||
| list5000 = L.take 5000 nats | ||
| list10000 = L.take 10000 nats | ||
| list100000 = L.take 100000 nats | ||
|
|
||
| log "map: empty list" | ||
| let emptyList = L.Nil | ||
| bench \_ -> mapFn emptyList | ||
|
|
||
| log "map: singleton list" | ||
| let singletonList = L.Cons 0 L.Nil | ||
| bench \_ -> mapFn singletonList | ||
|
|
||
| log $ "map: list (" <> show (L.length list1000) <> " elems)" | ||
| bench \_ -> mapFn list1000 | ||
|
|
||
| log $ "map: list (" <> show (L.length list2000) <> " elems)" | ||
| bench \_ -> mapFn list2000 | ||
|
|
||
| log $ "map: list (" <> show (L.length list5000) <> " elems)" | ||
| bench \_ -> mapFn list5000 | ||
|
|
||
| log $ "map: list (" <> show (L.length list10000) <> " elems)" | ||
| bench \_ -> mapFn list10000 | ||
|
|
||
| log $ "map: list (" <> show (L.length list100000) <> " elems)" | ||
| bench \_ -> mapFn list100000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| module Bench.Main where | ||
|
|
||
| import Prelude | ||
| import Control.Monad.Eff (Eff) | ||
| import Control.Monad.Eff.Console (CONSOLE, log) | ||
|
|
||
| import Bench.Data.List (benchList) | ||
|
|
||
| main :: Eff (console :: CONSOLE) Unit | ||
| main = do | ||
| log "List" | ||
| log "====" | ||
| benchList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exported right now, is that deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. It isn't. Good catch.