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

Quicksort R benchmark is broken. #735

Merged
merged 1 commit into from
Apr 19, 2012
Merged

Quicksort R benchmark is broken. #735

merged 1 commit into from
Apr 19, 2012

Conversation

crowding
Copy link
Contributor

The quicksort was written as though R passes mutable references, which it doesn't (R uses a copy-on-write scheme like Matlab/Octave). The recursive call to qsort_kernel did nothing, and produced an o(N^2) algorithm due to all the private copies of 'a' being made.

If you want to operate on an array in place, one way is to hold the array in an enclosing scope and use <<- operator.

@JeffBezanson
Copy link
Member

Thanks!

JeffBezanson added a commit that referenced this pull request Apr 19, 2012
Quicksort R benchmark is broken.
@JeffBezanson JeffBezanson merged commit b3251fe into JuliaLang:master Apr 19, 2012
KristofferC added a commit that referenced this pull request Sep 18, 2018
(cherry picked from commit 8e91d902458b9dbeab76fa7194ee58d1a6137334)
(cherry picked from commit 909508ab4b4458b6f58c0a870bd3b7f896e5a818)
KristofferC added a commit that referenced this pull request Sep 19, 2018
(cherry picked from commit 8e91d902458b9dbeab76fa7194ee58d1a6137334)
(cherry picked from commit 909508ab4b4458b6f58c0a870bd3b7f896e5a818)
(cherry picked from commit a416c9f)
KristofferC added a commit that referenced this pull request Feb 11, 2019
(cherry picked from commit 8e91d902458b9dbeab76fa7194ee58d1a6137334)
(cherry picked from commit 909508ab4b4458b6f58c0a870bd3b7f896e5a818)
(cherry picked from commit a416c9f)
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