Harendra Kumar
154a610eb2
Fix build for ghc-7.10.3
2017-09-05 13:34:39 +05:30
Harendra Kumar
e2b1e4c45d
Fix worker dispatch
2017-09-05 10:50:20 +05:30
Harendra Kumar
560d322678
Remove the recorder stuff for now
2017-09-04 16:39:39 +05:30
Harendra Kumar
28de8ffe31
Use BSD3 license
2017-09-04 16:13:32 +05:30
Harendra Kumar
2944896619
Fix MonadIO/MonadTrans imports/reexports
2017-09-04 06:31:00 +05:30
Harendra Kumar
09a717ced9
Add take and drop operations
2017-09-04 06:05:34 +05:30
Harendra Kumar
9ddfeae9d2
remove some comments
2017-09-03 16:59:41 +05:30
Harendra Kumar
3946e8f062
rename variable
2017-09-03 16:25:28 +05:30
Harendra Kumar
a0d9419533
do not send worker when workqueue is empty
2017-09-03 16:24:19 +05:30
Harendra Kumar
921a0e7c72
remove some redundant stuff
2017-09-03 16:18:51 +05:30
Harendra Kumar
8bb60599a5
Minor code rearrangement
2017-09-03 07:57:50 +05:30
Harendra Kumar
e06b3193d9
Simplify runqueue operations for parallel composition
2017-09-03 07:36:06 +05:30
Harendra Kumar
b3fa110784
Use Michael-Scott lockfree queue for FIFO policy
2017-09-02 12:48:34 +05:30
Harendra Kumar
e5e001675c
rearrange code
2017-09-02 03:16:17 +05:30
Harendra Kumar
999b6292b8
Perform first task inline instead of queueing
2017-09-02 03:04:36 +05:30
Harendra Kumar
2e4fc99237
Use IORefs with CAS and MVar instead of TBQueue
...
Improves performance significantly.
2017-09-01 19:13:20 +05:30
Harendra Kumar
f1a6409e2f
rearrange code
2017-09-01 07:44:34 +05:30
Harendra Kumar
ff84127946
Fix benchmarks and package deps
2017-08-31 06:11:46 +05:30
Harendra Kumar
036437ce91
implement fair interleaving of parallel tasks
2017-08-30 14:58:28 +05:30
Harendra Kumar
af09d3162a
Gain some perf by passing the q to dequeueLoop
...
Unboxing reboxing of context to get the q is saved
2017-08-30 04:14:21 +05:30
Harendra Kumar
9da2f40d0d
Move forkworker out of fast path
2017-08-30 03:49:38 +05:30
Harendra Kumar
62bca27864
Gain some perf by moving code out of fast path
2017-08-30 03:10:53 +05:30
Harendra Kumar
095349d367
Add MonadError, MonadReader and MonadState instances
2017-08-29 12:47:33 +05:30
Harendra Kumar
39af783eb5
Add Fractional and Floating instance
2017-08-29 11:39:09 +05:30
Harendra Kumar
6e183cfbb0
Simplify Num instance
2017-08-29 11:35:37 +05:30
Harendra Kumar
07c13575d0
rename operators
2017-08-29 11:31:19 +05:30
Harendra Kumar
5c34cc6d78
add API to convert a callback to AsyncT
2017-08-29 11:19:32 +05:30
Harendra Kumar
c81684d415
Add left biased combinator and some utilities
...
Remove 'for' and 'each'
2017-08-29 10:44:03 +05:30
Harendra Kumar
5f1dc97a9a
Add interleaved composition
2017-08-29 07:55:26 +05:30
Harendra Kumar
57e6232aba
Add comment about applicative
2017-08-29 05:49:27 +05:30
Harendra Kumar
ed22c1c907
minor fix use mempty instead of empty in Monoid fold
2017-08-29 00:18:07 +05:30
Harendra Kumar
e637b6c280
cleanup
2017-08-28 08:24:08 +05:30
Harendra Kumar
4e26aa558b
Remove stale code, rename the type to AsyncT
2017-08-28 08:05:49 +05:30
Harendra Kumar
b9603ccef0
Remove stale stuff
2017-08-28 07:51:46 +05:30
Harendra Kumar
6ce4d8adde
remove monad-control stuff
2017-08-28 07:47:35 +05:30
Harendra Kumar
f9f6c96d7a
rename queue variables
2017-08-28 07:03:38 +05:30
Harendra Kumar
e2b2acd6b5
Start new worker when existing ones are slow
2017-08-28 06:57:31 +05:30
Harendra Kumar
a0e2a34bbe
Fix continuation of the push loop after pull is done
2017-08-28 02:11:10 +05:30
Harendra Kumar
86f575d6de
simplify pullworker code
2017-08-28 00:40:17 +05:30
Harendra Kumar
5db931586e
Simplify push code
2017-08-28 00:23:14 +05:30
Harendra Kumar
064bb7e2cd
Some simplifications
2017-08-27 08:08:18 +05:30
Harendra Kumar
bdaefb3cff
Reuse threads instead of creating fresh every time
...
Improved the empty thread benchmark by more than 5 times. Work is now queued
to a common queue and all the worker threads pick it up from there.
2017-08-27 02:23:21 +05:30
Harendra Kumar
e8a746382d
Use TBQueue instead of an unbounded channel
2017-08-26 03:03:45 +05:30
Harendra Kumar
b3faafaecb
Solve the problem of last dispatch blocking drain
...
By always having the last dispatch in another thread. This has significant
impact on performance due to an extra thread or some other reason?
2017-08-25 23:58:38 +05:30
Harendra Kumar
2248afac5e
Simplify runner functions
2017-08-25 23:38:54 +05:30
Harendra Kumar
1f01190cca
Fix bug due to typo in pull finalizer and move it
2017-08-24 03:46:44 +05:30
Harendra Kumar
d8c399e567
Implement tracking and killing of child threads
2017-08-22 21:45:58 +05:30
Harendra Kumar
36ecdf82e3
Perf - do not save pending work in the context
2017-08-22 17:17:35 +05:30
Harendra Kumar
6ec80a0f92
Fix draining of threads (serial instead of parallel)
2017-08-22 17:01:07 +05:30
Harendra Kumar
04fef4fe4f
Move a function in dep order
2017-08-21 22:31:42 +05:30
Harendra Kumar
09283c42ac
Implement pull based concurrency rate control
2017-08-21 21:10:09 +05:30
Harendra Kumar
b1ee90ec4e
Add the yield API
2017-08-19 03:22:59 +05:30
Harendra Kumar
500d889859
Simplify push-pull split, fix monoid instance
2017-08-18 07:12:29 +05:30
Harendra Kumar
b2faaf91ba
remove a couple of stale comments
2017-08-17 19:18:22 +05:30
Harendra Kumar
b38be3a834
Reduce channel communication for short tasks
...
Combine the last done message with yield
2017-08-17 19:07:37 +05:30
Harendra Kumar
91a6cee5ed
Simplify push
2017-08-17 18:14:44 +05:30
Harendra Kumar
9b2ca30312
Add the "for" parallel API and change "each" to serial
2017-08-17 04:42:45 +05:30
Harendra Kumar
63f965a784
cleanup Monoid instance
2017-08-17 01:43:14 +05:30
Harendra Kumar
6ea73b3d10
Cleanup and refactor threading stuff
2017-08-17 01:29:56 +05:30
Harendra Kumar
e874ecf575
Remove quadratic complexity due to serially-in-serially
2017-08-16 15:18:17 +05:30
Harendra Kumar
550eed458f
Make monoid instance append two computations in order
...
Conflicts:
test/Main.hs
2017-08-15 18:41:20 +05:30
Harendra Kumar
ef006c846d
Implement fork for Alternative instance
2017-08-15 18:36:26 +05:30
Harendra Kumar
9f7d672422
Simplify toList runner
2017-08-11 13:36:07 +05:30
Harendra Kumar
c9b9ab35db
Pass context directly, removing the use of State monad
2017-08-11 12:59:33 +05:30
Harendra Kumar
f4cce2f9a3
Separate the bind and <|> semantics for parallelism
2017-08-10 15:24:47 +05:30
Harendra Kumar
7b52ccfff6
Partially fix the recording stuff
...
handlResult is still to be used
2017-08-10 00:13:05 +05:30
Harendra Kumar
f8851aa158
Add MonadRecorder instance to AsynclyT
2017-08-09 18:21:28 +05:30
Harendra Kumar
4f3775d51f
Enable threads API and tests
2017-08-09 17:44:05 +05:30
Harendra Kumar
17b30bafb7
rename the runner APIs
2017-08-09 17:30:33 +05:30
Harendra Kumar
504800bebe
More cleanup in RunAsync
2017-08-09 17:19:02 +05:30
Harendra Kumar
bb5a74d32a
Some cleanups
2017-08-09 16:22:25 +05:30
Harendra Kumar
eca7d81223
Remove redundant composition primitives
...
These can be simulated using a wait on an event and lifting/discarding
the result.
2017-08-09 15:37:10 +05:30
Harendra Kumar
a20c180451
Some cleanup
2017-08-09 02:11:16 +05:30
Harendra Kumar
99d9ba6c07
Fix the composite benchmark code
2017-08-08 20:37:11 +05:30
Harendra Kumar
c1f0a867c3
Continuation based implementation
...
Seems to have similar (slightly worse) performance as the lazy impl without
continuations.
lazy-streaming witout continuations without StateT = 400 ms
with continuations without StateT = 550 ms
However with continuations we do not need SPECIALIZE which is a significant
advantage to freely use in any Monad wihtout worrying about perf.
2017-08-08 15:23:14 +05:30
Harendra Kumar
7e8209e2d6
Separate the State layer from AsyncT layer
...
Performance degrades by 2x
StateT/AsyncT combined = 560 ms
Separated AsyncT (StateT Context IO) = 1.2 s
AsyncT IO in the separated version = 400 ms
2017-08-07 19:55:38 +05:30
Harendra Kumar
4d7024fae0
Initial poc of lazy streaming
2017-08-07 15:15:09 +05:30
Harendra Kumar
c49732a7a6
Move the each primitive to right place
2017-08-04 13:31:38 +05:30
Harendra Kumar
4d4894c6f1
Move the thread contol primitive to threads module
2017-07-21 14:13:55 +05:30
Harendra Kumar
3c7a92a35d
Move around some code
2017-07-21 14:03:36 +05:30
Harendra Kumar
0d9243fc0a
Separate the threadstate management layer
2017-07-21 13:54:02 +05:30
Harendra Kumar
31b3b5b1d0
Rename the Threads module
2017-07-21 11:30:47 +05:30
Harendra Kumar
3ed5abc542
Add some more SPECIALIZE and INLINE pragmas
2017-07-19 12:49:41 +05:30
Harendra Kumar
ce6719a6b8
More SPECIALIZE and CAS for atomicmodify
2017-07-19 11:17:02 +05:30
Harendra Kumar
b7d651f24d
SPECIALIZE monad, alternative and each for IO
2017-07-19 10:47:51 +05:30
Harendra Kumar
9ec9c527e3
add noinline pragma for bind
2017-07-19 08:58:15 +05:30
Harendra Kumar
e1fc30a63c
Remove additional binds, change continuations model
2017-07-19 08:43:52 +05:30
Harendra Kumar
59c0bac57b
Change foldl to foldr in "each"
2017-07-19 08:16:02 +05:30
Harendra Kumar
d64225fe30
Reorganize code top to bottom in dependency order
...
for AsyncT.hs
2017-07-16 17:49:07 +05:30
Harendra Kumar
1be7567d2b
Remove redundant unsafeCoerce
2017-07-15 13:20:34 +05:30
Harendra Kumar
1d8d3878cc
Minor doc fix
2017-07-15 12:38:25 +05:30
Harendra Kumar
e5da40c94c
Add some doc updates
2017-07-14 11:07:12 +05:30
Harendra Kumar
8340241116
Split the logging functionality into a separate package
2017-07-13 18:21:26 +05:30
Harendra Kumar
795dd4b905
Some code reorg
2017-07-08 15:44:17 +05:30
Harendra Kumar
c60d15c39a
Add "afterFirst" run an action after first event
2017-07-08 15:39:38 +05:30
Harendra Kumar
922c9ed018
Fix, cleanup and test discarding compositions
2017-07-08 14:09:43 +05:30
Harendra Kumar
f5cfead136
Alternative now forks automatically
...
Alternative "can" fork an action
`async` primitive is used to force an action to be async
2017-07-08 07:31:49 +05:30
Harendra Kumar
1e4950dac0
Simplify continuation saving and retrieval
...
Reduce untyped fields in the context
Merge Context.hs to AsyncT.hs
2017-07-03 05:16:26 +05:30
Harendra Kumar
4a176487ea
Add makeAsync to convert callbacks into AsyncT actions
2017-07-01 04:24:14 +05:30
Harendra Kumar
f4237bfab3
rename to asyncly
2017-07-01 02:02:39 +05:30
Harendra Kumar
fe02431534
Keep just one basic async primitive, remove the rest
2017-07-01 01:35:49 +05:30
Harendra Kumar
120d0ed5f0
Add API to gather results of multiple computations
2017-06-29 05:40:29 +05:30
Harendra Kumar
760a298598
rename APIs
2017-06-29 05:21:11 +05:30
Harendra Kumar
f455a06d0a
Make logs work with regular wait/gather APIs too
2017-06-29 03:59:27 +05:30
Harendra Kumar
a9d6c29ba7
implement log replay
2017-06-29 03:32:48 +05:30
Harendra Kumar
746f3b2a23
Remove redundant Typeable constraint
2017-06-28 21:44:02 +05:30
Harendra Kumar
bf5a11889e
Add logging APIs
2017-06-28 21:40:09 +05:30
Harendra Kumar
3a988778f6
Remove redundant stuff from Log.hs
2017-06-26 18:27:12 +05:30
Harendra Kumar
b2f67d3482
Put Log.hs in order
2017-06-26 18:03:01 +05:30
Harendra Kumar
6afc667110
Add comments
2017-06-26 15:30:48 +05:30
Harendra Kumar
1b31d0baf1
Move an unsafeCoerce to a better place
2017-06-26 15:24:26 +05:30
Harendra Kumar
3251739569
Remove parentChannel from context
2017-06-26 15:18:38 +05:30
Harendra Kumar
e41e3151ae
Simplify result passing, direct to the IORef
2017-06-26 15:02:44 +05:30
Harendra Kumar
467a301542
Move the user state related stuff out of Context.hs
2017-06-26 03:27:58 +05:30
Harendra Kumar
b9c1c92dc0
Add the wait primitive to discard the results
2017-06-26 03:14:36 +05:30
Harendra Kumar
d4f2fec43f
Rename the monad runner to 'gather'
2017-06-26 02:21:53 +05:30
Harendra Kumar
9915f732f1
fix dev documentation
2017-06-26 00:58:01 +05:30
Harendra Kumar
3103c1c82e
rename resumeContext to composeContext
2017-06-26 00:15:03 +05:30
Harendra Kumar
76cd2cc2e0
Minor refactor
2017-06-25 23:34:17 +05:30
Harendra Kumar
ef686400b4
Reorganize modules
2017-06-25 23:25:38 +05:30
Harendra Kumar
608d3efcfa
Reorganize modules
2017-06-25 21:45:32 +05:30
Harendra Kumar
8a0fdb3abd
Refactor/fix returning results from child threads
2017-06-25 21:23:14 +05:30
Harendra Kumar
f49eccb296
Fix context propagation in case of loopContextWith
2017-06-25 04:42:37 +05:30
Harendra Kumar
3d530e0fe3
Rename the package to "strands"
2017-06-24 17:43:59 +05:30
Harendra Kumar
5cde66cde5
Make sure the results are passed on to parents in all cases
...
In both async and sync invocation of an action.
2017-06-24 17:26:40 +05:30
Harendra Kumar
82e0996582
cleanup/refactor mailbox related functionality
2017-06-22 19:03:50 +05:30
Harendra Kumar
5522fb0979
Use MonadPlus instead of Alternative
2017-06-22 17:58:56 +05:30
Harendra Kumar
38b148f7c5
Do not use IORef for results
2017-06-22 17:44:33 +05:30
Harendra Kumar
cad6f1913b
remove stop
2017-06-22 13:12:42 +05:30
Harendra Kumar
9779a0b082
Pass results from children to parent
2017-06-22 13:11:29 +05:30
Harendra Kumar
c49bcc7406
Pass on exceptions and results from child to parent
2017-06-21 15:15:21 +05:30
Harendra Kumar
6fd665167e
Add some comments
2017-06-20 18:17:31 +05:30
Harendra Kumar
da2491da43
Return a maybe value from resumed context
...
- it will be useful for returning values from a computation continued in a new
thread.
2017-06-20 18:16:42 +05:30
Harendra Kumar
11deaa73be
rename function to appropriate name
2017-06-20 13:42:35 +05:30
Harendra Kumar
1b2ac02e4e
rename for clarity
2017-06-14 00:31:07 +05:30
Harendra Kumar
6a572e5279
Refactor, simplify forking the context
2017-06-14 00:27:29 +05:30
Harendra Kumar
bb402cb4d7
Fix react
2017-06-12 02:01:54 +05:30
Harendra Kumar
a439149806
Refactor forking and context resumtpion
2017-06-12 01:51:23 +05:30
Harendra Kumar
4eda27263c
Rename variables, add comments
2017-06-11 21:22:20 +05:30
Harendra Kumar
9f2c3c23c1
rename location attributes and context resumption
2017-06-11 17:07:52 +05:30
Harendra Kumar
4adbddf74c
Add context save, restore and continue functions
...
Modularize the context functionality
2017-06-11 02:56:22 +05:30
Harendra Kumar
a39705bb0d
More refactor, reorg, remove additonalOperators class
2017-06-10 17:08:12 +05:30
Harendra Kumar
a00f8c58bf
Change coerced type for illustrative purpose
2017-06-10 16:48:04 +05:30
Harendra Kumar
dcb01042cd
remove mfSequence
2017-06-10 16:45:48 +05:30
Harendra Kumar
70c2917343
rename EventF to Context
2017-06-10 16:41:30 +05:30
Harendra Kumar
0a69aecc0f
Refactor, simplify, add comments
2017-06-10 16:34:31 +05:30
Harendra Kumar
dde36a399e
Simplify applicative and monad instances
2017-06-10 02:45:24 +05:30
Harendra Kumar
3744363427
Remove the parent pointer from EventF
2017-06-08 01:23:06 +05:30
Harendra Kumar
45e820430e
Remove threadId from EventF
2017-06-08 00:53:20 +05:30
Harendra Kumar
e4bbcd6b4d
Format import list
2017-06-08 00:35:56 +05:30
Harendra Kumar
df9febd5bd
Use threadId tracking instead of EventF for children
2017-06-08 00:34:20 +05:30
Harendra Kumar
1bcf579e4b
Kill children on exception
2017-06-07 23:54:33 +05:30
Harendra Kumar
7ae04e3124
Add some notes and minor fixes
2017-06-07 23:37:58 +05:30
Harendra Kumar
aaeeec5fca
Remove some redundant code
2017-06-07 21:27:18 +05:30
Harendra Kumar
b90da15d00
Initial commit
...
A simplified, refactored and modified version of transient. Significant
differences from transient include:
1) Supports transformer stack
2) Each thread waits for its child threads to complete before exiting
2017-06-07 21:02:27 +05:30