Commit Graph

47 Commits

Author SHA1 Message Date
Simon Marlow
bc1f39f477 Build the benchmarks only if requested
Reviewed By: niteria

Differential Revision: D6172800

fbshipit-source-id: 6ded874ff575d35a564808be2bdf29347b39a3ca
2017-10-31 04:23:46 -07:00
Simon Marlow
3dbb11f6fe Cleanup and fix builds with other GHC versions
Summary:
Now that the Haxl 2 diff has landed, I wanted to take the opportunity to reorganise the codebase.

I split parts of `Haxl.Core.Types` out into

* `Haxl.Core.Flags`, the `Flags` type and functions
* `Haxl.Core.DataSource`: the `DataSource` class and related stuff

and I split the massive `Haxl.Core.Monad` module into smaller modules:

* the base `Haxl.Core.Monad` with the types and instances
* `Haxl.Core.Fetch`: data-fetching functionality
* `Haxl.Core.Run`: the scheduler, and `runHaxl`
* `Haxl.Core.Profile`: profiling
* `Haxl.Core.Parallel`: `pAnd` and `pOr`
* I've also moved all the memoization support into `Haxl.Core.Memo`.

This commit also fixes the build on GHC 7.8.x, 7.10.x, and 8.2.x, all the Travis builds are green again.

Closes https://github.com/facebook/Haxl/pull/79

Reviewed By: zilberstein

Differential Revision: D6030246

Pulled By: simonmar

fbshipit-source-id: 5a0dc708cf72f8ed0906f1e99000976dbfbc89e2
2017-10-27 03:37:32 -07:00
Simon Marlow
b67f7f6370 Haxl 2
Summary:
This is a complete reworking of the way that Haxl schedules I/O.  The
main benefits are:

* Data fetches are no longer organised into rounds, but can be
  arbitrarily overlapped with each other and with computation.  The
  scheduler supports an arbitrary queue of work items which it can
  evaluate while data-fetching is taking place in the background.  To
  take advantage of this, data sources must implement a new form of
  `PerformFetch`, namely `BackgroundFetch`.  The old forms of
  `PerformFetch` are still supported, but won't benefit from any
  additional concurrency.

* It is now possible to specify on a per-data-source basis whether
  fetching should be optimised for batching or for latency.  A request
  to a data source that doesn't benefit from batching can be submitted
  immediately.  This is done with the new `schedulerHint` method of
  `DataSource`.

Reviewed By: niteria

Differential Revision: D4938005

fbshipit-source-id: 96f12ad05ee62d62474ee4cc1215f19d0a6fcdf3
2017-10-03 00:28:54 -07:00
Bartosz Nitka
f1df1cb368 Prepare for 0.5.1.0 release
Summary:
We need a release for GHC 8.2.1 compatibility:
https://github.com/facebook/Haxl/issues/70

(Note: this ignores all push blocking failures!)

Reviewed By: simonmar

Differential Revision: D5488485

fbshipit-source-id: 61ae115e7456beb1dd8855d387690e13a1e09bdc
2017-07-25 04:24:40 -07:00
Bartosz Nitka
142f53c473 Test with GHC 8.2.1
Summary: GHC 8.2.1 has been released.

Reviewed By: watashi

Differential Revision: D5478389

fbshipit-source-id: 1be337521e409bbb4c01ef9b22d164973519a3aa
2017-07-23 22:08:55 -07:00
Simon Marlow
1e0d31e278 Fix text dependency
Summary: text prior to 1.2.1.0 doesn't work because we need the Binary instance

Reviewed By: niteria

Differential Revision: D5027630

fbshipit-source-id: d6eeefb40a19ae2c0aaccaad868dc42ed4976ea5
2017-05-09 04:18:48 -07:00
Simon Marlow
a9dd8ee43e Fix license spec in the .cabal file (#67)
Reviewed By: codemiller

Differential Revision: D4938031

fbshipit-source-id: 1ac10bec8a6d53ab3863a9045c0d3a9ee696369a
2017-04-24 05:38:39 -07:00
Simon Marlow
493c42fa0f Handle exceptions correctly in async datasources
Reviewed By: zilberstein, niteria

Differential Revision: D4868473

fbshipit-source-id: 0daf35e23f7ca4e87c3316786f3ac7a8ee7148cf
2017-04-19 12:27:42 -07:00
Oleg Grenrus
6a218f9110 Allow aeson-1.2
Summary: Closes https://github.com/facebook/Haxl/pull/69

Differential Revision: D4897787

Pulled By: watashi

fbshipit-source-id: aa8cbcb52822b0a1a3d31112313f495fc11efe1c
2017-04-16 18:53:48 -07:00
Oleg Grenrus
f3d340924c Bump more bounds
Summary:
- `binary-0.9` is accidental major jump and is now deprecated, I'm not sure what's best to do, cabal solver should pick `-0.8.x.y.` version
- `HUnit` and `time` changes do not affect use in haxl.
Closes https://github.com/facebook/Haxl/pull/68

Differential Revision: D4843906

Pulled By: JonCoens

fbshipit-source-id: b97c78e644a170745d7a29aab5c137e86f7018be
2017-04-06 10:18:42 -07:00
Oleg Grenrus
990b80cbc6 Test with GHC 8.0.2
Summary:
If this goes ok, can we have a release?
Closes https://github.com/facebook/Haxl/pull/66

Reviewed By: simonmar

Differential Revision: D4409114

Pulled By: niteria

fbshipit-source-id: 6d6e88f1cf7b9ae2d851eaa86966f2eb417b4d7e
2017-01-12 10:01:33 -08:00
Oleg Grenrus
d8f2eeed13 Allow vector-0.12, time-1.7; Drop unused directory
Summary: Closes https://github.com/facebook/Haxl/pull/65

Reviewed By: xich

Differential Revision: D4391469

Pulled By: niteria

fbshipit-source-id: d9a54fe6c4a255c0e82b26aca2849265fd7e8b53
2017-01-08 12:31:32 -08:00
Oleg Grenrus
d77b818a82 Allow aeson-1.1
Summary:
Alternatively we could change dependency to `aeson-compat`, which has less major version bumps (because it has smaller public API surface, yet one have to be careful .e.g. not to rely on instance implementations).
Closes https://github.com/facebook/Haxl/pull/64

Differential Revision: D4385525

Pulled By: xich

fbshipit-source-id: 72246e0f9144728e618de7bfcf983531bd3d281a
2017-01-05 17:01:26 -08:00
Oleg Grenrus
b0a5f7b8a8 Rename Show1 to ShowP
Summary:
Resolve #62
Closes https://github.com/facebook/Haxl/pull/63

Reviewed By: JonCoens

Differential Revision: D4299180

Pulled By: niteria

fbshipit-source-id: 0bcbefd26184d1e7ad5de99a806ce0cf4b57d1a6
2016-12-09 14:31:39 -08:00
Bartosz Nitka
b8cb1d850f Bump version before release
Summary: Closes https://github.com/facebook/Haxl/pull/61

Reviewed By: darshankapashi

Differential Revision: D4222554

Pulled By: niteria

fbshipit-source-id: d634be076eef94c00277952e6c8bc1920b052f89
2016-11-22 14:16:26 -08:00
Bartosz Nitka
c3d650e173 Allow HUnit 1.5
Summary:
According to #1965:

> Stackage nightly builds will soon move to HUnit-1.5.
Closes https://github.com/facebook/Haxl/pull/60

Reviewed By: xich

Differential Revision: D4221036

Pulled By: niteria

fbshipit-source-id: d3b011c7510ab9eceed9a1afdce0e55ed0983cf0
2016-11-22 13:01:33 -08:00
Oleg Grenrus
bc791fd734 Allow HUnit-1.4
Summary: Closes https://github.com/facebook/Haxl/pull/59

Reviewed By: niteria

Differential Revision: D3987227

Pulled By: algoriddle

fbshipit-source-id: 3be85a3eef2f40fd0a0efe0aee09714646632b4f
2016-10-07 05:46:38 -07:00
Oleg Grenrus
f80fe801a2 Make haxl compile cleanly with stack build --pedantic
Summary: Closes https://github.com/facebook/Haxl/pull/56

Reviewed By: JonCoens

Differential Revision: D3973977

Pulled By: simonmar

fbshipit-source-id: 527e17407dbeb3376955733949b0edb8b581122a
2016-10-05 05:46:30 -07:00
Gergely Szilvasy
98b403f0a4 fix package
Summary: Some of the test files were not listed in haxl.cabal

Reviewed By: kuk0

Differential Revision: D3951346

fbshipit-source-id: 8e6677a728acde3713c618a6383b2de510b1ac86
2016-09-30 10:01:37 -07:00
Gergely Szilvasy
187bd49f54 increasing version in haxl.cabal
Summary: Increasing package version before uploading on hackage.

Reviewed By: JonCoens

Differential Revision: D3944387

fbshipit-source-id: 146ed68970b7d3d6486b0e10f7d183e60e37257b
2016-09-30 03:16:33 -07:00
Andrew Farmer
528bba5565 Add unit test to demonstrate withLabel with pure/haxl exceptions
Summary:
Labels which throw Haxl exceptions are recorded, but pure exceptions bubble up
and labels are lost. This test demonstrates this.

Reviewed By: simonmar

Differential Revision: D3672479

fbshipit-source-id: fab10878e7eb067e0c65bcf401d75604c333007f
2016-08-22 08:31:36 -07:00
Oleg Grenrus
bc4a25c61e Support aeson-1
Summary: Closes https://github.com/facebook/Haxl/pull/54

Reviewed By: kuk0

Differential Revision: D3696720

Pulled By: niteria

fbshipit-source-id: f04ba17a24a74dcc0de8b1c4336c59e28d5a427d
2016-08-10 08:16:40 -07:00
Gergely Szilvasy
251ad5c3e5 Version bounds on binary package
Summary:
Putting version bounds on binary package in haxl.cabal
Closes https://github.com/facebook/Haxl/pull/48

Reviewed By: watashi

Differential Revision: D3371245

Pulled By: algoriddle

fbshipit-source-id: 574cbbe3ee081bd4e8af7c91fa89cf6ab6a03029
2016-06-07 15:16:29 -07:00
Gergely Szilvasy
1893551564 Unbreak cabal test
Summary: Some tests were failing, but we ignored the test failures by not checking the return value from the test runner. This patch fixes both the test runner and the tests.

Reviewed By: watashi

Differential Revision: D3379609

fbshipit-source-id: 0a1278879faa5beb0f9779ddfaa622cdbf05a73f
2016-06-04 15:31:43 -07:00
Andrew Farmer
b5a305b5c1 Count rounds/fetches for profiling labels.
Summary:
This collects the highest round in which a label adds a fetch, as well as
number of fetches per label per datasource. It reports these, along with
aggregated values with scuba sample of profiling data.

Aggregation for number of rounds is the maximum round of label or any of
label's children. Aggregation for number of fetches is sum.

Reviewed By: simonmar

Differential Revision: D3316018

fbshipit-source-id: 152690c7b8811d22f566437675c943f755029528
2016-06-04 15:20:42 -07:00
Gergely Szilvasy
19b024634b resolve test runner conflict
Summary: We use a FB-specific test runner in fbcode. As a result currently tests/Main.hs is different on github to allow 'cabal test' to pass. This diff resolves the difference by creating a common list of tests and two separate entry points for running the tests: tests/Main.hs for internal use, and tests/TestMain.hs for github. tests/Main.hs will (eventually) be excluded from the public sources.

Reviewed By: simonmar

Differential Revision: D3371609

fbshipit-source-id: 46a7382df814687230db43136acd496d0c5ebca9
2016-06-02 06:44:43 -07:00
Gergely Szilvasy
c1638504d1 Add missing dependency in haxl.cabal
Summary: We use Data.Binary so the binary package is required for Haxl to build.

Reviewed By: niteria, kuk0

Differential Revision: D3365843

fbshipit-source-id: 4e1198a1d27dac91e6525fc163aaeb10f7a65972
2016-05-31 08:50:31 -07:00
Simon Marlow
32eeb6879a Update haxl.cabal
Summary: We added a new module

Reviewed By: JonCoens

Differential Revision: D2254852

fbshipit-source-id: 223af03aeea4c1d24e098be70108d31cf0b3bb67
2016-05-31 07:25:22 -07:00
Andrew Farmer
83f9fff80f Name MemoFingerprintKeys
Summary: Associate names with MemoFingerprintKeys. This adds two unboxed string fields to MemoFingerprintKey. (One for module name, one for feature name.) Each is a pointer to a statically allocated CString, which we can then turn into a Text for withLabel.

Reviewed By: simonmar

Differential Revision: D3257819

fbshipit-source-id: 6279103c0879
2016-05-31 06:11:23 -07:00
Simon Marlow
f09fc218c3 Merge branch 'master' of https://github.com/facebook/Haxl
* 'master' of https://github.com/facebook/Haxl:
  Try to compile with GHC 8.0.1
  Use hvr travis setup
  Update aeson and time
2016-05-23 10:36:40 +01:00
Simon Marlow
3c299cc1fd bump to 0.3.1.0 2016-05-23 10:36:23 +01:00
Oleg Grenrus
4e7e04140d Use hvr travis setup 2016-02-09 16:19:27 +02:00
Oleg Grenrus
63a57a2c43 Update aeson and time 2016-02-09 15:51:34 +02:00
Oleg Grenrus
419f602551 Add MonadThrow and MonadCatch instances 2015-10-29 18:18:59 +02: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
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
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
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
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
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
Konstantine Rybnikov
dde76c9b3d Update aeson and text deps 2014-11-22 13:50:44 +02: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
74a3874f0b Initial open source import 2014-06-10 02:47:59 -07:00