Repository navigation
Conversation
Add `indicatormat(SparseMatrixCSC, x, ...)` as replacement for `indicatormat(x, ...; sparse=true)`. This is the only use of SparseArrays, which accounts for ~200 ms of the ~265 ms load time of StatsBase. Removing the keyword argument allows SparseArrays to become a weak dependency in StatsBase 0.35. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SparseArrays accounts for most of the load time of StatsBase (Julia 1.13.1, warm cache):
using StatsBaseusing SparseArrays(incl. SuiteSparse_jll)@time_imports)(
using SparseArraystakes 100-170 ms on Julia 1.10-1.13 since it is no longer part of the sysimage.)The only place where SparseArrays is used is
indicatormat(...; sparse=true). #885 tried to make SparseArrays a weak dependency but was closed since it would breaksparse=trueif SparseArrays is not loaded. This PR follows the suggestion in #885 (comment) instead:indicatormat(SparseMatrixCSC, x, k)andindicatormat(SparseMatrixCSC, x, c=sort!(unique(x)))sparse(bothsparse=trueandsparse=false)This is non-breaking. In a follow-up PR for StatsBase 0.35, the keyword argument can be removed and SparseArrays can be moved to an extension, reducing the load time of StatsBase to ~65 ms.
Context: TuringLang/MCMCDiagnosticTools.jl#177 (comment)
🤖 Generated with Claude Code