Skip to content

perf: Remove sorting to yield sorted_rank - #3693

Merged
Dandandan merged 1 commit into
apache:masterfrom
askoa:sorted-rank
Feb 11, 2023
Merged

perf: Remove sorting to yield sorted_rank#3693
Dandandan merged 1 commit into
apache:masterfrom
askoa:sorted-rank

Conversation

@askoa

@askoaaskoa commented Feb 11, 2023

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

I was looking through arrow_ord module for adding run array. I noticed the function sorted_rank was doing unnecessary sorting. The function can do its job in O(N) time. The changes resulted in non-trivial performance improvement in sort_kernel for dictionary.

dict string 2^12 time: [33.434 µs 33.549 µs 33.695 µs]
change: [-13.791% -11.994% -10.202%] (p = 0.00 < 0.05)
Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
2 (2.00%) high mild
10 (10.00%) high severe

Note: Thanks to the documentation of the function. Wouldn't have noticed this otherwise.

/// e.g. [2, 4, 3, 1, 0] -> [4, 3, 0, 2, 1]

What changes are included in this PR?

Remove unnecessary sorting in sorted_rank function.

Are there any user-facing changes?

No.

@github-actionsgithub-actionsBot added the arrow Changes to the arrow crate label Feb 11, 2023
@Dandandan
Dandandan merged commit 3cf64df into apache:masterFeb 11, 2023
@ursabot

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = 5261009 and contender = 3cf64df. 3cf64df is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@Dandandan

Copy link
Copy Markdown
Contributor

Thanks @askoa 😎

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrowChanges to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@askoa@ursabot@Dandandan@viirya