Giter Club home page Giter Club logo

Comments (7)

mhansen avatar mhansen commented on July 2, 2024

from hledger-vscode.

the-solipsist avatar the-solipsist commented on July 2, 2024

I'm not a coder, but I believe this is the code which the Atom add-on uses:
https://github.com/4ourbit/language-ledger/blob/master/lib/language-ledger.coffee#L46-L91

from hledger-vscode.

mhansen avatar mhansen commented on July 2, 2024

from hledger-vscode.

simonmichael avatar simonmichael commented on July 2, 2024

from hledger-vscode.

the-solipsist avatar the-solipsist commented on July 2, 2024

And as per @simonmichael, hledger check (or perhaps hledger check parseable) would be the fastest / most appropriate command for checking validity.

from hledger-vscode.

mhansen avatar mhansen commented on July 2, 2024

Looks like hledger-flycheck emacs plugin invokes "hledger check" on the shell: https://github.com/DamienCassou/flycheck-hledger/blob/master/flycheck-hledger.el#L63

Thanks for the pointers. Let's try some benchmarks on my shiny new M1 (which should be a bit faster than my other laptop):

$ hyperfine "hledger check" "hledger check parseable" "hledger bal" "hledger stats"
Benchmark #1: hledger check
  Time (mean ± σ):     471.3 ms ±   5.1 ms    [User: 438.8 ms, System: 26.9 ms]
  Range (min … max):   465.7 ms … 477.8 ms    10 runs
 
Benchmark #2: hledger check parseable
  Time (mean ± σ):     471.5 ms ±   6.0 ms    [User: 439.8 ms, System: 26.4 ms]
  Range (min … max):   465.1 ms … 480.2 ms    10 runs
 
Benchmark #3: hledger bal
  Time (mean ± σ):     582.1 ms ±   6.0 ms    [User: 545.0 ms, System: 30.8 ms]
  Range (min … max):   575.4 ms … 593.4 ms    10 runs
 
Benchmark #4: hledger stats
  Time (mean ± σ):     559.5 ms ±   4.8 ms    [User: 527.9 ms, System: 26.1 ms]
  Range (min … max):   555.9 ms … 568.2 ms    10 runs
 
Summary
  'hledger check' ran
    1.00 ± 0.02 times faster than 'hledger check parseable'
    1.19 ± 0.02 times faster than 'hledger stats'
    1.24 ± 0.02 times faster than 'hledger bal'

Looks like hledger check and hledger check parseable are about the same speed, both 19% faster than stats and 24% faster than bal.

Some stats about my journal:

$ hledger stats
...
Transactions span        : 2008-05-19 to 2022-09-04 (5221 days)
Last transaction         : 2022-09-03 (3 days ago)
Transactions             : 15529 (3.0 per day)
...
Run time (throughput)    : 0.57s (27471 txns/s)

I imagine it'd be near-instant if I split by year. I don't really want to split by year though.

Maybe to be quick, an extension could use hledger check on the currently-edited individual file along with --ignore-assertions, because none of my individual files balance correctly without other files. I was a bit surprised that check and check parseable apply the balance assertions (I would have guessed that's beyond the scope of parsing?).

from hledger-vscode.

simonmichael avatar simonmichael commented on July 2, 2024

from hledger-vscode.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.