Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Apr 24, 2024
1 parent 6f27725 commit a1e1241
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 12 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- main
- dev
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
pull_request:
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'

# Common environment variables
env:
RUSTFLAGS: "-C debuginfo=1"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
LOCK_FILE: Cargo.lock

jobs:
style-check:
name: style-check
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Run Style Check
run: |
make ci
- name: Run
run: |
make run
- name: Check git status
run: |
git diff --exit-code
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

ci: fmt clippy

clippy:
cargo clippy --all-targets --all-features

fmt:
cargo fmt -- --check

run:
cargo run --release
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Serialization-benchmark-rs
Benchmark for serialization in Rust, https://github.com/apache/incubator-horaedb/issues/1515.

# Related projects
- https://github.com/CeresDB/hash-benchmark-rs


# Usage
```sh
[]# serialization-benchmark-rs --help
Expand All @@ -17,8 +13,8 @@ Options:
-V, --version Print version


[]# ./serialization-benchmark-rs
Benchmark test, batch_size=1000000, result:
[]# ./serialization-benchmark-rs
Benchmark test, batch_size=1000000, result:

+------------+----------------+------------------+-------------+
| name | serialize time | deserialize time | cpu_utility |
Expand All @@ -28,7 +24,7 @@ Benchmark test, batch_size=1000000, result:
+------------+----------------+------------------+-------------+

[]# ./serialization-benchmark-rs --batch-size 5000000
Benchmark test, batch_size=5000000, result:
Benchmark test, batch_size=5000000, result:

+------------+----------------+------------------+-------------+
| name | serialize time | deserialize time | cpu_utility |
Expand All @@ -38,7 +34,7 @@ Benchmark test, batch_size=5000000, result:
+------------+----------------+------------------+-------------+

[]# ./serialization-benchmark-rs --enable-unsafe
Benchmark test, batch_size=1000000, result:
Benchmark test, batch_size=1000000, result:

+------------+----------------+------------------+-------------+
| name | serialize time | deserialize time | cpu_utility |
Expand All @@ -48,3 +44,6 @@ Benchmark test, batch_size=1000000, result:
+------------+----------------+------------------+-------------+
```


# Related projects
- https://github.com/CeresDB/hash-benchmark-rs
5 changes: 2 additions & 3 deletions src/main.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use sysinfo::{CpuRefreshKind, RefreshKind, System};
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
struct Args {
#[clap(default_value = "1000000", long, env)]
#[clap(long, short('b'), default_value = "1000000")]
batch_size: usize,

#[arg(long, env, help = "use unsafe feature within flatbuffer")]
#[arg(long, short('u'), help = "use unsafe feature within flatbuffer")]
enable_unsafe: bool,
}

Expand Down Expand Up @@ -140,4 +140,3 @@ fn main() {

table.printstd();
}

2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate flatbuffers;
#[rustfmt::skip]
mod fbperson_generated;
mod pbperson;
use fbperson_generated::fbdemo::{FBPerson, FBPersonArgs, FBPet, FBPetArgs};
Expand Down Expand Up @@ -175,4 +176,3 @@ impl Serializable for ProtobufObject {
context.duration.1 += start_time.elapsed();
}
}

0 comments on commit a1e1241

Please sign in to comment.