-
Notifications
You must be signed in to change notification settings - Fork 596
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bitmap: use pointer-sized element for underlying buffer Signed-off-by: Runji Wang <wangrunji0408@163.com> * use `Box<[usize]>` to save 8 bytes Signed-off-by: Runji Wang <wangrunji0408@163.com> * rename functions and add docs Signed-off-by: Runji Wang <wangrunji0408@163.com> * add bench for bitmap Signed-off-by: Runji Wang <wangrunji0408@163.com> Signed-off-by: Runji Wang <wangrunji0408@163.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
Showing
30 changed files
with
252 additions
and
580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,7 @@ tempfile = "3" | |
[[bench]] | ||
name = "bench_encoding" | ||
harness = false | ||
|
||
[[bench]] | ||
name = "bitmap" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2022 Singularity Data | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use risingwave_common::buffer::Bitmap; | ||
|
||
fn bench_bitmap(c: &mut Criterion) { | ||
const CHUNK_SIZE: usize = 1024; | ||
let x = Bitmap::zeros(CHUNK_SIZE); | ||
let y = Bitmap::ones(CHUNK_SIZE); | ||
let i = 0x123; | ||
c.bench_function("zeros", |b| b.iter(|| Bitmap::zeros(CHUNK_SIZE))); | ||
c.bench_function("ones", |b| b.iter(|| Bitmap::ones(CHUNK_SIZE))); | ||
c.bench_function("get", |b| b.iter(|| x.is_set(i))); | ||
c.bench_function("and", |b| b.iter(|| &x & &y)); | ||
c.bench_function("or", |b| b.iter(|| &x | &y)); | ||
c.bench_function("not", |b| b.iter(|| !&x)); | ||
} | ||
|
||
criterion_group!(benches, bench_bitmap); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.