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

Remove rising_factorial(::Int, ::Int) #1546

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

fingolfin
Copy link
Member

The version from AbstractAlgebra is actually faster and avoids allocations.

And this gets rid of one instances of type piracy, see #1495

Before:

julia> @benchmark sum(i->rising_factorial(10,i), 1:12)
BenchmarkTools.Trial: 10000 samples with 210 evaluations.
 Range (min … max):  352.976 ns … 519.090 μs  ┊ GC (min … max):  0.00% … 53.77%
 Time  (median):     359.324 ns               ┊ GC (median):     0.00%
 Time  (mean ± σ):   768.972 ns ±  14.411 μs  ┊ GC (mean ± σ):  28.19% ±  1.50%

     ▁     ▂█▃
  ▁▂▇█▅▂▁▂▄███▅▂▂▂▂▂▃▃▂▂▂▂▂▂▂▂▂▁▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  353 ns           Histogram: frequency by time          389 ns <

 Memory estimate: 192 bytes, allocs estimate: 12.

After:

julia> @benchmark sum(i->rising_factorial(10,i), 1:12)
BenchmarkTools.Trial: 10000 samples with 992 evaluations.
 Range (min … max):  38.348 ns … 144.111 ns  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     38.516 ns               ┊ GC (median):    0.00%
 Time  (mean ± σ):   39.126 ns ±   2.919 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%

  █▄▁▁▂▃▁  ▁▁▂▁                                                ▁
  █████████████▅▅▄▅▁▅▆▆▅▄▅▅▅▅▅▄▄▄▄▅▄▅▃▄▃▄▅▅▄▄▅▅▅▅▄▅▄▄▅▅▅▅▅▄▅▅▅ █
  38.3 ns       Histogram: log(frequency) by time      54.1 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

The version from AbstractAlgebra is actually faster and avoids
allocations.
@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Merging #1546 (ac78e75) into master (5b857fe) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1546      +/-   ##
==========================================
- Coverage   84.05%   84.02%   -0.03%     
==========================================
  Files          94       94              
  Lines       36613    36605       -8     
==========================================
- Hits        30774    30759      -15     
- Misses       5839     5846       +7     
Files Coverage Δ
src/flint/fmpz.jl 91.42% <ø> (+0.11%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@thofma thofma merged commit 49a671a into Nemocas:master Sep 29, 2023
14 of 15 checks passed
@fingolfin fingolfin deleted the mh/rising_factorial-Int branch September 29, 2023 12:36
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