Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use displaysize in show unless limit=true is set #179

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

jondeuce
Copy link
Contributor

@jondeuce jondeuce commented Dec 3, 2024

Essentially the same issue as JuliaSparse/SparseArrays.jl#233.

Current behaviour (ignores :limit => false):

julia> using TimerOutputs

julia> @timeit String('a':'z')^4 1+1;

julia> show(stdout, get_defaultimer())
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                                            Time                    Allocations      
                                                                                                                   ───────────────────────   ────────────────────────
                                                 Tot / % measured:                                                     5.95ms /   0.1%            136KiB /   0.2%    

Section                                                                                                    ncalls     time    %tot     avg     alloc    %tot      avg
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz        1   7.39μs  100.0%  7.39μs      272B  100.0%     272B
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
julia> sprint(show, get_defaultimer(); context = :limit => false) |> println
────────────────────────────────────────────────────────────────────────────────
                                       Time                    Allocations      
                              ───────────────────────   ────────────────────────
      Tot / % measured:           7.63ms /   0.1%            190KiB /   0.1%    

Section               ncalls     time    %tot     avg     alloc    %tot      avg
────────────────────────────────────────────────────────────────────────────────
abcdefghijklmnopqr...      1   7.39μs  100.0%  7.39μs      272B  100.0%     272B
────────────────────────────────────────────────────────────────────────────────

With this PR:

julia> sprint(show, get_defaultimer(); context = :limit => false) |> println
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                                            Time                    Allocations      
                                                                                                                   ───────────────────────   ────────────────────────
                                                 Tot / % measured:                                                      8.96s /   0.0%           20.8MiB /   0.0%    

Section                                                                                                    ncalls     time    %tot     avg     alloc    %tot      avg
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz        1   7.39μs  100.0%  7.39μs      272B  100.0%     272B
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@KristofferC KristofferC merged commit 75b5757 into KristofferC:master Dec 3, 2024
9 checks passed
@jondeuce jondeuce deleted the patch-1 branch December 4, 2024 20:07
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.

2 participants