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

Use sampler-based Random API #206

Merged
merged 1 commit into from
Aug 8, 2020
Merged

Use sampler-based Random API #206

merged 1 commit into from
Aug 8, 2020

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Jul 24, 2020

Closes #196, Fixes #125

This avoids the performance problem with ReinterpretArray. On the other hand, the time for generating the random number array with the default RNG is significantly increased.

I chose a minimalistic and straightforward implementation for now.

@codecov
Copy link

codecov bot commented Jul 24, 2020

Codecov Report

Merging #206 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #206      +/-   ##
==========================================
+ Coverage   87.84%   87.89%   +0.05%     
==========================================
  Files           6        6              
  Lines         469      471       +2     
==========================================
+ Hits          412      414       +2     
  Misses         57       57              
Impacted Files Coverage Δ
src/FixedPointNumbers.jl 82.78% <100.00%> (+0.23%) ⬆️

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 ae6b911...ec05ad7. Read the comment docs.

@timholy
Copy link
Member

timholy commented Aug 6, 2020

How bad is the regression for generation? unsafe_wrap isn't that scary, personally I think we should use it.

This avoids the performance problem with `ReinterpretArray`.
@kimikage
Copy link
Collaborator Author

kimikage commented Aug 7, 2020

I added a method using unsafe_wrap. It resolves the speed performance regression. I don't think GC.@preserve is needed there, but I'm not sure.

@kimikage
Copy link
Collaborator Author

kimikage commented Aug 8, 2020

Thank you for your prompt review.

@kimikage kimikage merged commit 3e41a6a into JuliaMath:master Aug 8, 2020
@kimikage kimikage deleted the random branch August 8, 2020 01:36
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request Apr 27, 2024
This prevents `rand` from returning a `ReinterpretArray` to avoid the performance problem with `ReinterpretArray` .
This also supports specifying the RNG option.
@kimikage kimikage mentioned this pull request Apr 30, 2024
38 tasks
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request Apr 30, 2024
This prevents `rand` from returning a `ReinterpretArray` to avoid the performance problem with `ReinterpretArray` .
This also supports specifying the RNG option.
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
This prevents `rand` from returning a `ReinterpretArray` to avoid the performance problem with `ReinterpretArray` .
This also supports specifying the RNG option.
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
This prevents `rand` from returning a `ReinterpretArray` to avoid the performance problem with `ReinterpretArray` .
This also supports specifying the RNG option.
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 1, 2024
This prevents `rand` from returning a `ReinterpretArray` to avoid the performance problem with `ReinterpretArray` .
This also supports specifying the RNG option.
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 28, 2024
kimikage added a commit to kimikage/FixedPointNumbers.jl that referenced this pull request May 28, 2024
kimikage added a commit that referenced this pull request May 28, 2024
This also backports the changes in PR #270, #278.
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.

[RFC] Use of Random API poor performance
2 participants