forked from ds4dm/Tulip.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Helps with the performance of the BigFloat arithmetic. The change shouldn't affect other arithmetics, but it's coded so it'd be easy to extend it to another arithmetic like BigFloat, should one appear in the ecosystem (for example a pure Julia big float type). A script for measuring allocation, uses my packages that are on Gitlab: ``` setprecision(BigFloat, 2^11) using PolynomialPassingThroughIntervals, PolynomialApproximation const max_error = eps(Float64) / 2 const monomials_even = UInt8[i for i in 0:2:16] degree_trig_domain(offset::Int, n::Int) = Rational{BigInt}[offset + (x//n)*45 for x in big"0":n] perturbed_dtd(offset::Int, n::Int) = perturbed(degree_trig_domain(0, n), 1//8) perturbed_dtd_pow2(offset::Int, exp::Int) = perturbed_dtd(offset, 2^exp) function min_pol_cosd(exp::Int) dom = perturbed_dtd_pow2(0, exp) image = [(big"0.0", big"1.0") for i in 1:length(dom)] values = map(cosd ∘ BigFloat, dom) @Timev "exp = $exp" minimal_polynomial_passing_through_intervals_easy( monomials_even, dom, image, values, max_error) end min_pol_cosd(6) println() min_pol_cosd(9) ``` On master (a0032b5): ``` exp = 6: 28.425369 seconds (177.57 M allocations: 27.151 GiB, 13.17% gc time, 22.09% compilation time) elapsed time (ns): 28425368965 gc time (ns): 3744847370 bytes allocated: 29152935010 pool allocs: 177349665 non-pool GC allocs: 9273 malloc() calls: 117773 realloc() calls: 88512 free() calls: 116745 minor collections: 634 full collections: 0 exp = 9: 309.997183 seconds (1.39 G allocations: 217.327 GiB, 32.12% gc time) elapsed time (ns): 309997182893 gc time (ns): 99577583042 bytes allocated: 233353489632 pool allocs: 1385706165 non-pool GC allocs: 59648 malloc() calls: 729278 realloc() calls: 553593 free() calls: 734173 minor collections: 5232 full collections: 3 ``` After this commit: ``` exp = 6: 28.219849 seconds (159.69 M allocations: 24.350 GiB, 12.86% gc time, 22.40% compilation time) elapsed time (ns): 28219848824 gc time (ns): 3628115620 bytes allocated: 26145903664 pool allocs: 159476551 non-pool GC allocs: 9290 malloc() calls: 118019 realloc() calls: 88752 free() calls: 116991 minor collections: 568 full collections: 0 exp = 9: 311.400227 seconds (1.26 G allocations: 197.588 GiB, 32.10% gc time) elapsed time (ns): 311400226728 gc time (ns): 99971520894 bytes allocated: 212158223648 pool allocs: 1259460435 non-pool GC allocs: 60794 malloc() calls: 728027 realloc() calls: 553972 free() calls: 724639 minor collections: 4736 full collections: 3 ``` There's no performance improvement for a single call above, but there's less allocation, which should translate to better real-world performance, I guess.
- Loading branch information
Showing
4 changed files
with
165 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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