Speed
tidyMacro against the reference MATLAB codes, same specifications, same thread budget
Every specification on the Validation page was timed in tidyMacro and in the MATLAB code it is compared with. The data, lag orders, horizons and draw counts are the same on both sides.
- Thread budget. Both sides get 3 threads. tidyMacro receives
n_threads = 3; MATLAB runs undermaxNumCompThreads(3). The reference MATLAB codes have noparforloops, so in MATLAB the budget only reaches multithreaded linear algebra. - Timing. Wall-clock time of one complete call, including VAR estimation. Each routine is run once untimed as a warm-up. Monte Carlo routines are then timed 3 times with different seeds and deterministic routines 20 times. The reported figure is the median.
- Sign + external IV. The full Cesa-Bianchi and Sokol (2022) specification takes hours in the VAR Toolbox, so a lighter version is timed: one instrument (the monetary-policy surprise) instead of two, and the financial-shock signs imposed on impact only.
- LP-DiD is not timed, because its reference is Stata output.
- Machine. Intel Core i5-7360U (2 cores, 4 threads), macOS 13.6, MATLAB R2025b, R 4.6.0, tidyMacro 1.1.2.
| Median seconds per call | ||||||
| Same data and specification on both sides; 3 threads each | ||||||
| Method | Data | Workload | tidyMacro function | MATLAB (s) | tidyMacro (s) | Speed-up |
|---|---|---|---|---|---|---|
| Monte Carlo | ||||||
| Sign + external IV (light) | CBS2022 | 1,000 accepted draws, one IV, impact signs | fSignRestr(instrument =) | 17.8 | 0.288 | 62× |
| Sign + narrative | ADRR2018 | 1,000 accepted draws, Volcker 1979m10 | fSignRestr(narrative =) | 54.7 | 1.02 | 53× |
| Long run (Blanchard-Quah) | Gali1999 | 1,000 residual-bootstrap draws, h = 0-40 | fVAR + fBootstrapBQ | 7.97 | 0.152 | 52× |
| Sign restrictions | Uhlig2005 | 1,000 accepted draws, signs over h = 0-5 | fSignRestr | 27.1 | 0.610 | 44× |
| Short run (Cholesky) | Bloom2009 | 1,000 wild-bootstrap draws, h = 0-48 | fVAR + fBootstrapChol | 93.2 | 2.42 | 39× |
| External instrument (MBB) | Kaenzig2021 | 2,000 moving-block draws, h = 0-48 | fVAR + fBootstrapIVMBB | 11.7 | 2.43 | 4.8× |
| Deterministic | ||||||
| LP-IV | JordaTaylor2025IV | h = 0-48 | fLPIV | 0.0344 | 0.0125 | 2.7× |
| LP, exogenous shock | JordaTaylor2025 | h = 0-17 | fLP | 0.00974 | 0.00500 | 1.9× |
| Panel LP | MianSufiVerner2017 | h = 0-6, two shocks | fLPPanel | 0.0202 | 0.0125 | 1.6× |
| External instrument (MSW) | Kaenzig2021 | Weak-IV robust bands, h = 0-48 | fVAR + fMSW | 0.450 | 0.545 | 0.83× |