Go to file
Stephen Morgan 5e7b69356f lib: Change internal representation of MixedAmount to use a strict Map
instead of a list of Amounts. No longer export Mixed constructor, to
keep API clean (if you really need it, you can import it directly from
Hledger.Data.Types). We also ensure the JSON representation of
MixedAmount doesn't change: it is stored as a normalised list of
Amounts.

This commit improves performance. Here are some indicative results.

hledger reg -f examples/10000x1000x10.journal
- Maximum residency decreases from 65MB to 60MB (8% decrease)
- Total memory in use decreases from 178MiB to 157MiB (12% decrease)

hledger reg -f examples/10000x10000x10.journal
- Maximum residency decreases from 69MB to 60MB (13% decrease)
- Total memory in use decreases from 198MiB to 153MiB (23% decrease)

hledger bal -f examples/10000x1000x10.journal
- Total heap usage decreases from 6.4GB to 6.0GB (6% decrease)
- Total memory in use decreases from 178MiB to 153MiB (14% decrease)

hledger bal -f examples/10000x10000x10.journal
- Total heap usage decreases from 7.3GB to 6.9GB (5% decrease)
- Total memory in use decreases from 196MiB to 185MiB (5% decrease)

hledger bal -M -f examples/10000x1000x10.journal
- Total heap usage decreases from 16.8GB to 10.6GB (47% decrease)
- Total time decreases from 14.3s to 12.0s (16% decrease)

hledger bal -M -f examples/10000x10000x10.journal
- Total heap usage decreases from 108GB to 48GB (56% decrease)
- Total time decreases from 62s to 41s (33% decrease)

If you never directly use the constructor Mixed or pattern match against
it then you don't need to make any changes. If you do, then do the
following:

- If you really care about the individual Amounts and never normalise
  your MixedAmount (for example, just storing `Mixed amts` and then
  extracting `amts` as a pattern match, then use should switch to using
  [Amount]. This should just involve removing the `Mixed` constructor.
- If you ever call `mixed`, `normaliseMixedAmount`, or do any sort of
  amount arithmetic (+), (-), then you should replace the constructor
  `Mixed` with the function `mixed`. To extract the list of Amounts, use
  the function `amounts`.
- If you ever call `normaliseMixedAmountSquashPricesForDisplay`, you can
  replace that with `mixedAmountStripPrices`. (N.B. this does something
  slightly different from `normaliseMixedAmountSquashPricesForDisplay`,
  but I don't think there's any use case for squashing prices and then
  keeping the first of the squashed prices around. If you disagree let
  me know.)
- Any remaining calls to `normaliseMixedAmount` can be removed, as that
  is now the identity function.
2021-05-01 09:45:29 -10:00
.github ;stack: build with lts-17/ghc-8.10.3 by default 2021-01-29 15:13:06 -08:00
.sandstorm Add --capabilities-header to launcher.sh 2018-06-24 17:44:22 +02:00
bin lib: Change internal representation of MixedAmount to use a strict Map 2021-05-01 09:45:29 -10:00
checks update dev setup tests 2015-03-16 17:59:06 -07:00
doc Add 'doc/haskellerz/' from commit '79beb34b900b5d35b065e145d6200d227de16945' 2021-04-30 13:03:44 -10:00
docker package: added helper scripts in docker/ 2019-01-31 12:44:12 -08:00
examples examples: csv: kraken 2021-04-19 17:22:04 -10:00
hledger lib: Change internal representation of MixedAmount to use a strict Map 2021-05-01 09:45:29 -10:00
hledger-install install: hledger-iadd 1.3.14 2021-03-14 10:16:09 -07:00
hledger-lib lib: Change internal representation of MixedAmount to use a strict Map 2021-05-01 09:45:29 -10:00
hledger-ui lib: Change internal representation of MixedAmount to use a strict Map 2021-05-01 09:45:29 -10:00
hledger-web lib: Change internal representation of MixedAmount to use a strict Map 2021-05-01 09:45:29 -10:00
shell-completion Rebuild completion after the rebase on upstream/master 2021-02-28 08:36:42 +01:00
tools tools: Include more commodities and prices in generated journals. 2021-03-05 10:12:49 -08:00
.ci ;api: another round of hledger-api purging; fix the build 2019-09-11 14:49:22 -07:00
.ctags cli, lib: move functional tests into hledger/test/ 2020-11-16 08:47:41 -08:00
.dockerignore package: added Dockerfile 2019-01-29 16:14:03 -08:00
.editorconfig fix datepicker not closing, linting 2017-12-30 13:44:40 -05:00
.ghci tools: use pretty-simple for ghci output 2020-11-03 08:19:01 -10:00
.gitignore web: --test [-- HSPECARGS] runs the test suite 2020-11-16 14:02:16 -08:00
.hlint.yaml refactor: lib: hlint cleanups 2019-02-14 05:15:49 -08:00
.mailmap doc: use consistent spelling of Mykola Orliuk 2017-03-27 05:47:15 -07:00
.version ;bump version to 1.21.99 2021-03-10 13:50:49 -08:00
azure-pipelines.yml ;api: another round of hledger-api purging; fix the build 2019-09-11 14:49:22 -07:00
bench.sh benchmarks: add some large (140, 1400 columns) tabular reports 2020-11-03 17:30:10 -10:00
cabal.project ;cabal: fix cabal.project error with cabal 3.4 2021-03-12 07:01:48 -08:00
CHANGES.md ;finalise changelogs 2021-03-10 11:10:13 -08:00
CONTRIBUTING.md ;doc: ui, web, contributing: fix image urls 2021-03-21 07:45:37 -07:00
CREDITS.md ;doc: CREDITS cleanup 2020-03-21 18:37:49 -07:00
dev.hs collect some langage pragmas in dev.hs 2019-02-20 18:08:33 -08:00
Dockerfile ;api: another round of hledger-api purging; fix the build 2019-09-11 14:49:22 -07:00
hie.yaml ;tools: silence hls errors for Shake.hs 2020-12-07 12:27:03 -08:00
LICENSE add LICENSE 2008-10-01 07:52:07 +00:00
Makefile HaskellerZ 2021-04-29 meetup slides 2021-04-30 12:32:50 -10:00
Makefile.helpsys make: rename sub-makefiles; start moving site script to make/shake 2019-03-05 18:43:04 -08:00
README.md ;doc: readme: drop badges header 2020-08-21 08:18:26 -07:00
ROADMAP.md ;roadmap: status 2020-08-29 14:45:50 -07:00
Shake.hs ;shake webmanuals: update toc/versions placeholders 2021-03-21 09:01:33 -07:00
stack7.10.yaml.disabled ;simplify stack.yaml filenames 2020-03-30 15:35:53 -07:00
stack8.0.yaml stack: fix stack8.0.yaml (#1514) 2021-04-03 21:10:57 -07:00
stack8.2.yaml add missing dep for other stack snapshots; also bump GHC 8.10 to .2 2020-11-11 12:52:44 -08:00
stack8.4.yaml add missing dep for other stack snapshots; also bump GHC 8.10 to .2 2020-11-11 12:52:44 -08:00
stack8.6.yaml add missing dep for other stack snapshots; also bump GHC 8.10 to .2 2020-11-11 12:52:44 -08:00
stack8.8.yaml ;stack: build with lts-17/ghc-8.10.3 by default 2021-01-29 15:13:06 -08:00
stack9.0.yaml stack config for testing with GHC 9.0, WIP (#1503) 2021-04-06 07:59:11 -10:00
stack.yaml stack: bump default to lts-17.4/ghc-8.10.4 2021-03-05 14:56:33 -08:00

hledger project README

lightweight, portable, dependable accounting tools

hledger is a computer program for easily tracking money, time, or other commodities, on unix, mac and windows (and web-capable mobile devices, to some extent).

It is first a command-line tool, but there are also terminal and web interfaces, and a Haskell library for building your own programs and scripts (hledger is written in Haskell). hledger was inspired by and is largely compatible with Ledger. hledger is free software available under the GNU General Public License v3+.

hledger aims to help both computer experts and regular folks to gain clarity and control in their finances and time management, but currently it is a bit more suited to techies. I use it every day to:

  • track spending and income
  • see time reports by day/week/month/project
  • get accurate numbers for client billing and tax filing
  • track invoices

Though limited in features, hledger is lightweight, usable and reliable. For some, it is a simpler, less distracting, more future-proof alternative to Quicken or GnuCash.

For more, see the home page: https://hledger.org

Sponsorship

Your support, large or small, helps keep this project strong!
See also https://hledger.org#sponsorship.

Sponsor Simon (project leader): github liberapay paypal

Sponsor the hledger project as an organisation: OpenCollective

Sponsor the hledger project as an individual: OpenCollective

Bounties for specific tasks: all bounties bountysource bounties




license hledger CI on hackage github issues