Skip to content

Skip the cache update when a coordinate does not move, version 0.2.2 - #5

Merged
mlakolar merged 1 commit into
masterfrom
skip-zero-steps
Oct 22, 2026
Merged

mlakolar merged 1 commit into
masterfrom
skip-zero-steps

Conversation

@mlakolar

Copy link
Copy Markdown
Owner

Summary

The coordinate steps of CDInverseKroneckerLoss and CDInverseReducedSymKroneckerLoss updated the p × p cache A = Σx Θ Σy after every visit, even when the coordinate did not change, as for most coordinates that stay at zero in a full pass. Each visit thus cost O(p²), and a full pass O(p⁴). Both now return early when the change is zero, as CovSel's CDDirectDifferenceLoss already does. The iterates are bitwise unchanged (same hashes before and after in every case below). Version 0.2.2.

Timings

AR(1) data (ρ = 0.5 for X, 0.3 for Y), n = 500, entry (3, 2), one BLAS thread, Apple M3 Pro, Julia 1.13.2; minimum of three runs, in ms.

p = 30 p = 50 p = 80
invQSymHessian 3.7 → 1.1 28.5 → 3.4 140.0 → 7.8
invAsymHessianEstimation 21.8 → 18.8 115.7 → 96.3 656.4 → 480.4
estimate(SymmetricNormal) 21.2 → 17.9 92.0 → 73.1 464.4 → 292.7
estimate(AsymmetricNormal) 38.5 → 34.9 184.9 → 162.0 901.5 → 755.4

The two coordinate descent solves inside invAsymHessianEstimation became 17× faster at p = 50 and 80× at p = 80 (22.2 → 1.3 ms and 176.1 → 2.2 ms, single runs). The function as a whole gains less because its weights now take nearly all of its time: _computeVar! loops over all n samples for each of the p² entries, O(n p³) per call, about 2 × 240 ms at p = 80. That is the next thing to speed up, in a separate PR.

Test plan

  • Pkg.test() on Julia 1.13.2 and 1.10.12 (20184 tests pass on each; CovSel added from GitHub on 1.10, as CI does).
  • CI.

🤖 Generated with Claude Code

The coordinate steps of CDInverseKroneckerLoss and
CDInverseReducedSymKroneckerLoss updated the p × p cache A = Σx Θ Σy after
every visit, even when the coordinate did not change, as for most coordinates
that stay at zero in a full pass: each visit cost O(p²), a full pass over the
p² (or p(p+1)/2) coordinates O(p⁴). They now return early when the change is
zero, as CovSel's CDDirectDifferenceLoss does. The iterates are bitwise
unchanged.

On AR(1) data with n = 500 and one BLAS thread, invQSymHessian is 3.4×, 8.4×
and 18× faster at p = 30, 50 and 80, and estimate(SymmetricNormal) 1.2-1.6×.
The two coordinate descent solves in invAsymHessianEstimation are 17× faster at
p = 50 and 80× at p = 80, but the function only 1.2-1.4×, because its weights
(_computeVar!, O(n p³) per call) now take nearly all of its time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (3d8263b) to head (10d7875).

Additional details and impacted files
@@           Coverage Diff           @@
##           master       #5   +/-   ##
=======================================
  Coverage   98.64%   98.65%           
=======================================
  Files          12       12           
  Lines        1407     1409    +2     
=======================================
+ Hits         1388     1390    +2     
  Misses         19       19           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mlakolar
mlakolar merged commit 27ab947 into master Oct 22, 2026
6 checks passed
@mlakolar
mlakolar deleted the skip-zero-steps branch October 22, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant