Commit Graph

65 Commits

Author SHA1 Message Date
Oleg Grenrus
63a57a2c43 Update aeson and time 2016-02-09 15:51:34 +02:00
Simon Marlow
be4f0a1d7c Merge pull request #39 from phadej/monad-throw
Resolve #38: Add MonadThrow and MonadCatch instances
2015-10-29 13:40:35 -04:00
Oleg Grenrus
419f602551 Add MonadThrow and MonadCatch instances 2015-10-29 18:18:59 +02:00
Simon Marlow
77f6f710d4 Merge pull request #37 from phadej/dep-bump
Lax upper bounds
2015-10-29 11:08:03 -04:00
Oleg Grenrus
2a400204fb Lax upper bounds 2015-10-20 16:27:38 +03:00
Simon Marlow
037de9c594 Overhaul docs; bump to 0.3.0.0; add changelog
Summary: Tidy everything up in preparation for a Hackage reelase

Test Plan: cabal test; unit tests

Reviewed By: kjm@fb.com

Subscribers: anfarmer, kjm, jlengyel, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2516904

Signature: t1:2516904:1444297290:52077660599ab126ec8a3e4530808db7c15d1876
2015-10-12 06:23:49 -07:00
Simon Marlow
86a1e5c41f Move InitStrategy out of core
Summary:
It isn't used by anything else in core, it's really a local thing that
we're using in our own data sources, so moving it out to avoid
confusing Haxl open-source users.

Test Plan: contbuild

Reviewed By: watashi@fb.com

Subscribers: anfarmer, kjm, jlengyel, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2516897

Signature: t1:2516897:1444236927:0e6e204a0f4393e18931dea2e7ddba83e6123ba9
2015-10-12 06:23:47 -07:00
Simon Marlow
0f9ca4ea00 More warning-freedom with GHC 7.10
Test Plan: built it with GHC 7.10

Reviewed By: watashi@fb.com

Subscribers: anfarmer, kjm, jlengyel, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2494818

Tasks: 6005053

Signature: t1:2494818:1443642397:d59465c015a7ea8baf69243bdc8c48056fb52c29
2015-10-07 01:16:32 -07:00
Simon Marlow
8a6f279731 Avoid warnings with GHC 7.10+
Test Plan: compile + unit tests

Reviewed By: watashi@fb.com

Subscribers: anfarmer, kjm, jlengyel, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2481161

Tasks: 6005053

Signature: t1:2481161:1443211927:71c808cfdc108bad1f2b129a337f907fa9daa95d
2015-10-07 01:16:32 -07:00
Andrew Farmer
2011053183 Use smart view in Blocked continuation to avoid quadratic bind behavior.
Summary:
Use the smart view technique from [1] to avoid quadratic behavior of
left-nested binds in the continuation of Blocked results. This makes the seql
benchmark linear (and quite fast).

(See before-and-after benchmark results in P20020178)

[1] http://dl.acm.org/citation.cfm?id=2784743

Test Plan:
Ran the Haxl core tests with `fbmake runtests`. Also compared the
microbenchmarks in MonadBench. (see P20020178)

End-to-end test results for top 25 contexts:

https://www.facebook.com/pxlcld/mPXZ
https://www.facebook.com/pxlcld/mPZ2
https://www.facebook.com/pxlcld/mPZ0
https://www.facebook.com/pxlcld/mPZ1

Based on those, not sure what to do. It does seem like a very slight improvement, but not strictly improving. Thoughts?

Reviewed By: smarlow@fb.com

Subscribers: ldbrandy, kjm, jlengyel, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2438616

Tasks: 8432911

Signature: t1:2438616:1442568800:bf2d1a18819c0ceeb6ea097379ec4bbc6364c0c2
2015-10-07 01:16:30 -07:00
Simon Marlow
fcfab9f860 Add a specialised Functor instance
Summary:
GHC didn't manage to optimise the previous version; this gives a
measurable speedup:

```
before:
> _build/opt/sigma/haxl/core/tests/monadbench/monadbench par1 1000000
1000000 reqs: 1.00s

after:
> _build/opt/sigma/haxl/core/tests/monadbench/monadbench par1 1000000
1000000 reqs: 0.85s
```

```
before:
> _build/opt/sigma/haxl/core/tests/monadbench/monadbench par2 100000 +RTS -s
100000 reqs: 0.32s
248,684,224 bytes allocated in the heap

after:
> _build/opt/sigma/haxl/core/tests/monadbench/monadbench par2 100000 +RTS -s
100000 reqs: 0.31s
236,684,208 bytes allocated in the heap
```

Test Plan: benchmarks

Reviewed By: bnitka@fb.com

Subscribers: ldbrandy, kjm, jlengyel, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2419420

Signature: t1:2419420:1441640543:d3d34e0aa0d639f08c0fc9589cd187bb63614c88
2015-10-07 01:16:28 -07:00
Simon Marlow
2d37f76bd4 Add a benchmark for basic Haxl monad patterns
Summary:
I'm using this to test variants of the monad.  In particular, the
current monad displays O(n^2) performance with the seql version of
this benchmark. This is a well-studied problem, see for example

"Reflection without remorse: revealing a hidden sequence to speed up
monadic reflection" (van der Ploeg / Kiselyov, Haskell '14)

Test Plan:
Built it and ran it a few times
unit tests still work

Reviewed By: bnitka@fb.com

Subscribers: ldbrandy, kjm, jlengyel, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2419419

Signature: t1:2419419:1441640727:9f5f82212c829fcbf2e8c063d4dbd0db495b0ba2
2015-10-07 01:16:22 -07:00
Simon Marlow
4462975bf6 Don't require Show for memo keys/values
Summary:
memo had a `Show` constraint on both the keys and values, to support
`dumpCacheAsHaskell`.  However

* We don't print out the memo cache in `dumpCacheAsHaskell`, only the
data cache, so we don't need memo entries to be showable.
* Requiring `Show` to memoize something is occasionally annoying
* Passing those `Show` dictionaries probably has some overhead

Test Plan:
* unit tests pass
* Ran `haxl/core/tests/Bench.hs` to measure the perf of the datacache,
saw no difference.

Reviewed By: kjm@fb.com

Subscribers: ldbrandy, kjm, jlengyel, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2336437

Tasks: 7779904

Signature: t1:2336437:1439376418:cca2aee6ce22e4320206a1212f6f81fda6f6ae49
2015-10-07 01:08:19 -07:00
Mayank Patke
ecc9247777 Added withEnv function to the Haxl monad
Summary: New withEnv function allows the user to override/ignore the Env set by runHaxl.

Test Plan: build

Reviewed By: smarlow@fb.com

Subscribers: ldbrandy, kjm, jlengyel, memo, watashi, smarlow, akr, bnitka, jcoens, mpawlowski

FB internal diff: D2255490

Signature: t1:2255490:1437399211:705f6aa9e14105618d1795145178aff6eff3d858
2015-10-07 01:08:19 -07:00
Simon Marlow
dea379f271 (>>) should be implemented as (*>)
Test Plan: new unit test

Reviewed By: akr@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2146859

Signature: t1:2146859:1434027756:806eb07efc3282857b7d2400c4b10b949495b476
2015-10-07 01:06:49 -07:00
Simon Marlow
09d5ede63e Add Eq instances to all the leaf exceptions
Summary: Makes it easier to write tests

Test Plan: contbuild

Reviewed By: bnitka@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2064498

Signature: t1:2064498:1431447501:c61dc564f40b318c0645ef5cd7b71d0814d36195
2015-10-07 01:06:43 -07:00
Simon Marlow
dfd8a4655e A haxl test for ApplicativeDo
Summary:
Test that the ApplicativeDo extension batches things correctly in the
Haxl monad.

Test Plan: beholdunittests

Reviewed By: bnitka@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D2039149

Tasks: 5504687

Signature: t1:2039149:1430501733:98fd1cf0f69663d6db3b07c3aed6e261ae9884d6
2015-10-07 01:06:35 -07:00
Simon Marlow
1d83953123 Add Haxl.Core.Memo 2015-10-07 00:59:28 -07:00
Jake Lengyel
9d8fe2c6aa Move memo to haxl/core
Summary: Move the functionality of memo to haxl/core, while retaining a Haxl wrapper in SI.

Test Plan: fbconfig -r sigma/haxl && fbmake runtests_opt

Reviewed By: smarlow@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens, wmay

FB internal diff: D1996371

Tasks: 4601157

Signature: t1:1996371:1429180518:6759e4dc2444bd942cde145d9de945430b3cba7e
2015-10-07 00:57:48 -07:00
Simon Marlow
1d996291a4 Merge pull request #34 from kantp/thunkleak
Close thunk leak in roundstats.
2015-07-17 16:25:11 +01:00
Philipp Kant
8f4d603dcd Close thunk leak in roundstats.
The function performFetches collects statistics about the requests
performed in each round. However, the list is not evaluated (unless
tracing is on), leading to an accumulation of thunks. Forcing the list
via deepseq prevents this.
2015-07-17 15:35:27 +02:00
Simon Marlow
8df642043c Update to PATENTS version 2
Test Plan: testinprod

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1994343

Signature: t1:1994343:1429108790:f719a3592f72d7b6117988fef1bc2ce3660574f1
2015-04-15 09:07:41 -07:00
Simon Marlow
2c604f5a5c add .travis.yml
Summary: To get continuous builds for github

Test Plan: testinprod

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1994369
2015-04-15 08:12:46 -07:00
Simon Marlow
6b1f7a69e9 0.2.0.0 (we've made backwards-incompatible changes) 2015-04-15 16:04:25 +01:00
Simon Marlow
19b3f63a4e 0.1.0.1 2015-04-15 16:00:54 +01:00
Simon Marlow
462beed8eb Fix GHC version-related build issues 2015-04-15 15:54:41 +01:00
watashi
580aadb747 Unbreak haxl on ghc 7.10
Some ghc internal packages bumped their versions.
Thanks @FranklinChen for reporting this issue.
Closes #28
2015-04-09 23:03:26 -07:00
Zejun Wu
9f873ed35a Update haxl copyright headers
Summary:
Update haxl copyright headers: s/2014/2014-present/g
Thank @siddharthasharma for pointing this out
Closes #26, #27

Test Plan: meh

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1903841

Signature: t1:1903841:1426073797:b95462075265fa8ec9c1252e45ef5cac7a37e7e2
2015-03-11 12:42:01 -07:00
Simon Marlow
c67b7af2e0 Don't drop async exceptions (e.g. AllocationLimitExceeded)
Summary:
Turning IO monad exceptions into Haxl monad exceptions can result in the
IO monad exception being lost, which is what was happening to our
AllocationLimitExceeded exceptions.  See the comment with
rethrowAsyncExceptions for more details.

See also D1870627

Test Plan:
P19741543 is a request that blows the alloc limit but wasn't being
caught before.

Reviewed By: akr@fb.com

Subscribers: ldbrandy, memo, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1870631

Tasks: 6240444

Signature: t1:1870631:1424867073:d03bd0368ee968cecbcc5a0f654772b6f0eaf147
2015-03-11 12:41:38 -07:00
watashi
96f5513f56 Remove TARGETS 2015-02-09 09:15:42 -08:00
Zejun Wu
6fb255fffc Make haxl/core self-contained and updated
Summary: Make haxl/core self-contained and sync github

Test Plan:
fbmake opt && fbmake runtests_opt
cabal build && cabal test

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1832398

Signature: t1:1832398:1423478473:5f81b865b86b7864c08af222d90990a1de3b3073
2015-02-09 08:56:49 -08:00
Andrew Farmer
4cce451bb5 Instrument runHaxl with traceEventIO
Summary:
Adds traceEventIO in right places to get pretty fetching visualizations.
These should be a no-op when compiled with eventlog disabled, but
I haven't measured to see if there is any actual overhead yet.

Test Plan:
compiled, ran replay and endtoend with no problems
waiting on full perf results to check for overhead

Reviewed By: smarlow@fb.com

Subscribers: trunkagent, ldbrandy, watashi, smarlow, akr, bnitka, jcoens, anfarmer

FB internal diff: D1666727

Tasks: 5564760, 5289531, 5289404

Signature: t1:1666727:1415714188:1e4b2322c8ae15c8d3552ec2bc290df94a683184
2015-02-06 14:48:11 -08:00
Andrew Farmer
cb33a2fb1e Add pretty-printing functions for Haxl's stats types.
Summary: Add functions to make the stats types human-readable.

Test Plan: compileandship

Reviewed By: smarlow@fb.com

Subscribers: ldbrandy, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1583342
2015-02-06 14:47:56 -08:00
Zejun Wu
668a8adc2e Collect time in each data sources in each round
Summary: Collect time in each data sources in each round

Test Plan:
test in haxlsh
test the overhead in replay

Reviewed By: smarlow@fb.com

Subscribers: anfarmer, ldbrandy, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1521346

Tasks: 4589842
2015-02-06 14:47:53 -08:00
Zejun Wu
23e7d06d7d Add flags to control the report level in Haxl
Summary: Add flags to control the report level (how much stats we will collect) in Haxl

Test Plan: runtests

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, watashi, smarlow, akr, bnitka, jcoens

FB internal diff: D1509184

Tasks: 4589842
2015-02-06 14:47:49 -08:00
Simon Marlow
a8b49026da Merge pull request #15 from k-bx/master
Update aeson and text deps
2014-11-22 16:42:32 +00:00
Konstantine Rybnikov
dde76c9b3d Update aeson and text deps 2014-11-22 13:50:44 +02:00
Simon Marlow
79d1f1eea9 Merge pull request #12 from zudov/patch-1
Added a note about the Prelude
2014-07-23 14:12:49 +01:00
Konstantin Zudov
423709177b Added a note about the Prelude
It took me some time to figure out that I forgot about the Prelude. Hope that this will help someone.
2014-07-23 16:07:47 +03:00
Zejun Wu
7411284239 Update exposed-modules in haxl.cabal
Summary:
Haxl.Core.Env and Haxl.Core.Fetch were collapsed into Haxl.Core.Monad in
D1427283. Update haxl.cabal to reflect this and use PatternGuards to
suppress warnings.

Test Plan: ~/local/haxl-github $ cabal test

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, smarlow, akr, bnitka, jcoens

FB internal diff: D1441939
2014-07-17 13:02:09 -07:00
Simon Marlow
18f2f1ab21 Rework memoization, fixing infinite loop problems
Summary:
See copious comments in the source for details.  The problem with the
previous approach was that it was too easy to lose the continuation that
contained the memo table update when exceptions are flying around, and
losing that continuation always results in an infinite loop.  This
solution is more robust, because we can never lose a continuation, the
worst that could happen (and it shouldn't happen) is that we do a bit of
repeated work.

Test Plan: unit tests, my infinite loop repro case is fixed

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, smarlow, akr, bnitka, jcoens

FB internal diff: D1427283

Tasks: 3734942
2014-07-17 13:02:06 -07:00
Simon Marlow
ca83d6070c Update the DataCache strictly
Summary:
We weren't forcing the DataCache after inserting a new element, which
meant that an error would appear when next using the cache, rather than
when we insert the element.

Test Plan: new unit test

Reviewed By: bnitka@fb.com

Subscribers: ldbrandy, smarlow, akr, bnitka, jcoens

FB internal diff: D1420686

Tasks: 4637866
2014-07-17 13:02:02 -07:00
Simon Marlow
2f4d6336b2 Add catchIf
Summary: Useful for catching multiple kinds of exception with a single handler.

Test Plan: haxl/core unit tests

Reviewed By: jon.coens@fb.com

Subscribers: ldbrandy, jonp, smarlow, akr, bnitka, jcoens

FB internal diff: D1387298

Tasks: 4526990, 3727129
2014-07-17 13:01:53 -07:00
Jon Coens
c90f8b0c8d Merge pull request #10 from facebook/change_link
Update link to example data sources
2014-06-25 19:14:00 -07:00
Jon Coens
13606a4fc7 Update link to example data sources 2014-06-25 18:59:17 -07:00
niteria
3bb91ac357 Merge pull request #9 from juhp/patch-1
replace getAllUsers by getAllUserIds
2014-06-23 15:21:15 -07:00
Jens Petersen
53cf6095fa replace getAllUsers by getAllUserIds 2014-06-23 14:00:53 +09:00
Simon Marlow
da1525d897 Sync the readme.md with the code
Summary: from PR 4

Test Plan: unit tests

Reviewed By: akr@fb.com

Subscribers: ldbrandy, jonp, smarlow, akr, bnitka, jcoens

FB internal diff: D1384640
2014-06-16 06:48:51 -07:00
Simon Marlow
e6dbb92d4b lint
Summary: From PR 5 on github

Test Plan: unit tests

Reviewed By: akr@fb.com

Subscribers: ldbrandy, jonp, smarlow, akr, bnitka, jcoens

FB internal diff: D1384641
2014-06-16 06:48:43 -07:00
Simon Marlow
6ddd602873 Add SVG logo
Test Plan: no tests

Reviewed By: akr@fb.com

Subscribers: ldbrandy, jonp, smarlow, akr, bnitka, jcoens

FB internal diff: D1381974
2014-06-16 06:48:28 -07:00