-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rand() performance restored with faster code path and inlining.
- Loading branch information
1 parent
ab0d6ca
commit 84b6aec
Showing
1 changed file
with
3 additions
and
3 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
84b6aec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ViralBShah Great! I remember having tested inlined
rand()
at some point (before #8854 I think, and without other@inline
s of this commit) but noticing degraded performances somewhere else (I think for the array versionrand(n::Int)
). What I find now is that this commit slows downrandn[!]
methods by up to 50%, do you confirm?I just pushed a branch where
randmtzig_randn
uses a non-inlined version ofrand
which seem to restore previous perfs ofrandn
, but this starts to make me feel uneasy with all those@inline
tweaks. Should I open a PR? (In this branch, I also revert/modify part of this commit because I thinkrand_close_open
is dSFMT specific so I prefer to keeprand(r::AbstractRNG) = rand(r, Float64)
which I find more self-documenting, do you agree?).84b6aec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On reverting part of the commit - does it affect performance? Given the code path and sensitivity to inlining, I think we can leave it as it is for now.
On
randn
I will comment on the PR.84b6aec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reverting part of the commit doesn't affect performance either way, so I will remove that from the branch.
84b6aec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @vtjnash that it's best to be quite conservative about adding
@inline
.