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

Make the cube root to be inlined #489

Merged
merged 1 commit into from
Jun 20, 2021
Merged

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Jun 18, 2021

This makes the cube root to be inlined to make it suitable for vectorization.
This is intended to reduce precompilation problems rather than increase the speed. (cf. #425)

This also optimizes the pow5_12(::Float32). Edit: I will separate this into a new PR. (Edit2: see PR #493)

@codecov
Copy link

codecov bot commented Jun 18, 2021

Codecov Report

Merging #489 (48109d3) into master (12f95f5) will increase coverage by 0.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #489      +/-   ##
==========================================
+ Coverage   93.12%   93.35%   +0.22%     
==========================================
  Files           9        9              
  Lines        1018     1053      +35     
==========================================
+ Hits          948      983      +35     
  Misses         70       70              
Impacted Files Coverage Δ
src/conversions.jl 99.68% <100.00%> (+<0.01%) ⬆️
src/utilities.jl 98.75% <100.00%> (+0.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12f95f5...48109d3. Read the comment docs.

@kimikage
Copy link
Collaborator Author

kimikage commented Jun 18, 2021

using Colors, BenchmarkTools
rgb_f64 = rand(RGB{Float64}, 1000, 1000);
xyz_f64 = XYZ{Float64}.(rgb_f64);
xyz_f32 = XYZ{Float32}.(xyz_f64);
lab_f64 = Lab{Float64}.(xyz_f64);
lab_f32 = Lab{Float32}.(lab_f64);
julia> @btime convert.(Lab, $xyz_f64);
  121.341 ms (5965520 allocations: 113.91 MiB) # before
  29.326 ms (2 allocations: 22.89 MiB) # before (recompiled)
  24.800 ms (2 allocations: 22.89 MiB) # after

julia> @btime convert.(Lab, $xyz_f32);
  129.864 ms (5965520 allocations: 102.47 MiB) # before
  23.362 ms (2 allocations: 11.44 MiB) # before (recompiled)
  23.656 ms (2 allocations: 11.44 MiB) # after

I'm still not sure what's going on. 😕

@kimikage kimikage force-pushed the cbrt branch 2 times, most recently from 59eff82 to 63ed178 Compare June 19, 2021 03:58
@kimikage kimikage marked this pull request as ready for review June 19, 2021 04:17
@kimikage kimikage changed the title [WIP] Make the cube root to be inlined Make the cube root to be inlined Jun 19, 2021
This makes the cube root to be inlined to make it suitable for vectorization.
This is intended to reduce precompilation problems rather than increase the speed.
@kimikage kimikage merged commit ddfc19b into JuliaGraphics:master Jun 20, 2021
@kimikage kimikage deleted the cbrt branch June 20, 2021 03:27
kimikage added a commit to kimikage/Colors.jl that referenced this pull request May 11, 2024
This makes the cube root to be inlined to make it suitable for vectorization.
This is intended to reduce precompilation problems rather than increase the speed.
kimikage added a commit that referenced this pull request May 11, 2024
This makes the cube root to be inlined to make it suitable for vectorization.
This is intended to reduce precompilation problems rather than increase the speed.
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.

1 participant