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

chore: add cast_decimal benchmark #6850

Merged
merged 3 commits into from
Dec 11, 2024
Merged

Conversation

andygrove
Copy link
Member

Which issue does this PR close?

Part of #6833

Rationale for this change

We need a benchmark to help review #6836

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Dec 6, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove -- I left some comments -- let me know what you think


fn criterion_benchmark(c: &mut Criterion) {
let decimals: ArrayRef = Arc::new(
Decimal128Array::from(vec![
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend creating a slightly larger array that mirrors actual workloads (e.g. 4k or 8k values, maybe just repeating these values multiple times).

Using a small array like may amplify the overheads of function invocation compared to the actual work being done

// specific language governing permissions and limitations
// under the License.

use arrow_array::{ArrayRef, Decimal128Array};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should put this along side the other benchmarks for cast in https://github.com/apache/arrow-rs/blob/main/arrow/benches/cast_kernels.rs#L1-L0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it turns out that we already have tests for this that I can easily modify 🙄

    c.bench_function("cast decimal128 to decimal128 512", |b| {
        b.iter(|| cast_array(&decimal128_array, DataType::Decimal128(30, 5)))
    });

@tustvold tustvold merged commit dc45d7d into apache:main Dec 11, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants