Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2335: Move selected primitive types to dedicated modules (Part 2). r=jonathanknowles a=jonathanknowles # Issue Number Preparation for [ADP-347](https://jira.iohk.io/browse/ADP-347) (_Wallet should support UTxOs containing multiple token types_). # Overview This PR cleans up a few loose ends left behind by PR #2329: - Renames `ChimericAccount` to `RewardAccount`. (see [related discussion](#2329 (review))) - Adds a module comment to `Primitive.Types.Tx`. (see [related discussion](#2329 (comment))) - Clarifies the module comment for `Primitive.Types.Address`. (see [related discussion](#2329 (comment))) It also moves the following UTxO-related types (and functions) to a new module: | Type | Destination Module | | -- | -- | | `UTxO` | `Cardano.Wallet.Primitive.Types.UTxO` | | `UTxOStatistics` | `Cardano.Wallet.Primitive.Types.UTxO` | | `Dom` | `Cardano.Wallet.Primitive.Types.UTxO` | | `HistogramBar` | `Cardano.Wallet.Primitive.Types.UTxO` | # Motivation The primary motivation for making these changes now, rather than later on, is to make development of multi-asset work more efficient. So this PR limits itself to types that are likely to be affected by the MA work, rather than breaking up the entirety of `Primitive.Types`. # Compilation Time Reductions Here's a comparison of how long it takes to re-compile the whole of `cardano-wallet-core` (including tests) after making a tiny change to the `UTxO` type: Before applying PR #2329 and PR #2335: ``` 0m46.404s 0m45.124s 0m44.854s ``` After applying PR #2329 and PR #2335: ``` 0m28.524s 0m28.364s 0m28.324s ``` That's approximately a 37% reduction in wall-clock time, with only slight changes to our module hierarchy. **Machine used:** ``` vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel(R) Xeon(R) CPU stepping : 7 microcode : 0x1 cpu MHz : 2800.174 cache size : 33792 KB ``` **Command:** ``` time stack build --ghc-options "-j +RTS -A256m -n4m -RTS" --fast --test --no-run-tests cardano-wallet-core ``` # Analysis This PR: * makes it possible for code to use the above types without having to incur a dependency on the `Cardano.Wallet.Primitive.Types` module, which (together with the modules that depend on it) is currently still large and quite slow to recompile. * makes it possible to compile the above types in parallel, saving overall compilation time. * makes module caching more effective: changes to one of the sub-modules will not necessarily invalidate the cache for the others, meaning that the compiler can often get away with compiling less code when changes are made. # Comments As before, this PR does not re-export the moved types from `Primitive.Types`, thereby forcing users of these types to import them directly from the module in which they're defined. This reduces the extent to which `Primitive.Types` is a compilation bottleneck. This PR follows the advice presented in [Keeping Compilation Fast](https://www.parsonsmatt.org/2019/11/27/keeping_compilation_fast.html) by Matt Parsons. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
- Loading branch information
Showing
50 changed files
with
628 additions
and
567 deletions.
There are no files selected for viewing
This file contains 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 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 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
Oops, something went wrong.