Skip to content

Comments

chore: add cast_decimal benchmark#6850

Merged
tustvold merged 3 commits intoapache:mainfrom
andygrove:decimal-cast-bench
Dec 11, 2024
Merged

chore: add cast_decimal benchmark#6850
tustvold merged 3 commits intoapache:mainfrom
andygrove:decimal-cast-bench

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.

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)))
    });

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