datafusion-contrib / datafusion-contrib/liquid-cache

Auto-vectorization benchmark

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Rust
Stars
452
Forks
51
Avg merge
3h 10m
Merged PRs (30d)
12

Description

We currently use fastlanes to bitpack wide integers into small integers: https://github.com/XiangpengHao/liquid-cache/blob/main/src/liquid_parquet/src/liquid_array/raw/bit_pack_array.rs

It has some test cases, to get an idea of what it does.

Step 1

But we don't have a benchmark yet. We want to study the performance of from_primitive: https://github.com/XiangpengHao/liquid-cache/blob/main/src/liquid_parquet/src/liquid_array/raw/bit_pack_array.rs#L63, encoding path

to_primitive: https://github.com/XiangpengHao/liquid-cache/blob/main/src/liquid_parquet/src/liquid_array/raw/bit_pack_array.rs#L125

We want to benchmark these two functions:

  1. varying the bitwidth -- value range from 2^{1-32}
  2. varying the number of integers in the array

Array size of 8192, multiple of 8192.
Datatype of UInt8 -> UInt64

Context: PrimitiveArray<T> is data type from Arrow: https://docs.rs/arrow/latest/arrow/array/struct.PrimitiveArray.html

Probably want study how arrow-rs represent primitive array: https://arrow.apache.org/docs/format/Columnar.html#fixed-size-primitive-layout, and how we represent bit_packed_array: https://github.com/XiangpengHao/liquid-cache/blob/main/src/liquid_parquet/src/liquid_array/raw/bit_pack_array.rs#L8

To benchmark, we prefer https://github.com/bheisler/criterion.rs, it will look like one of those benchmarks: https://github.com/apache/arrow-rs/blob/main/arrow/benches/arithmetic_kernels.rs

After getting benchmark results, we want to know the throughput, e.g., 1GB/s. Both encode and decode.

Step 2

We want to know which functions are been auto-vectorized. We probably need to look at assembly, which can use in this tool: https://github.com/pacak/cargo-show-asm

Bonus

FSST: https://github.com/XiangpengHao/liquid-cache/blob/main/src/liquid_parquet/src/liquid_array/raw/fsst_array.rs
string compression, which we also hope to have auto-vectorization.

cc @jp-reddy

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/liquid_parquet/src/liquid_array/raw/bit_pack_array.rs and the from_primitive and to_primitive paths. Add Criterion benchmarks varying bitwidth, array size, and UInt8–UInt64 types, then use cargo-show-asm to inspect auto-vectorization. Done means benchmark results report encode/decode throughput and identify which functions are auto-vectorized.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.