Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Dec 22, 2024

This PR improves performance by only applying the functions to the diagonal elements:

julia> A = diagm(0=>ones(100));

julia> @btime log($A);
  364.163 μs (22 allocations: 401.62 KiB) # master
  13.528 μs (7 allocations: 80.02 KiB) # this PR

Similar improvements for sqrt and cbrt as well.

@jishnub jishnub added arrays [a, r, r, a, y, s] performance Must go faster labels Dec 22, 2024
@codecov
Copy link

codecov bot commented Dec 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.89%. Comparing base (39a7e3c) to head (4f02f26).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1156      +/-   ##
==========================================
+ Coverage   91.85%   91.89%   +0.03%     
==========================================
  Files          34       34              
  Lines       15339    15345       +6     
==========================================
+ Hits        14090    14101      +11     
+ Misses       1249     1244       -5     

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

@jishnub jishnub merged commit 6e5ea12 into master Dec 23, 2024
4 checks passed
@jishnub jishnub deleted the jishnub/diagroot branch December 23, 2024 06:28
@stevengj
Copy link
Member

Someone is complaining on discourse that this causes a type instability: https://discourse.julialang.org/t/type-instability-and-or-behavior-instability-of-sqrt-on-nightly/125428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrays [a, r, r, a, y, s] performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants