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

Setup codspeed #17

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: build

on: [ push, pull_request ]
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "12 3 * * *"

jobs:
fmt:
Expand All @@ -23,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update && rustup override set 1.58.0 && rustup component add clippy
- run: rustup update && rustup override set 1.70.0 && rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets -- -D warnings -D clippy::all
- run: cargo clippy --all-targets --all-features -- -D warnings -D clippy::all
Expand Down Expand Up @@ -52,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update && rustup override set 1.58.0
- run: rustup update && rustup override set 1.70.0
- uses: Swatinem/rust-cache@v2
- run: cargo doc --all-features --no-deps
env:
Expand Down Expand Up @@ -85,3 +93,18 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo install typos-cli || true
- run: typos

codspeed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: rustup update
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-codspeed || true
- run: cargo codspeed build
- uses: CodSpeedHQ/action@v2
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ repository = "https://github.com/oxigraph/oxiri"
description = """
Simple and fast implementation of IRI validation and relative IRI resolution
"""
edition = "2018"
rust-version = "1.58"
edition = "2021"
rust-version = "1.60"

[dependencies]
serde = { version = "1", optional = true }

[dev-dependencies]
criterion = "0.4"
codspeed-criterion-compat = "2.3.3"
serde_test = "1"

[[bench]]
Expand Down
15 changes: 5 additions & 10 deletions benches/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use criterion::{criterion_group, criterion_main, Criterion};
use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion};
use oxiri::{Iri, IriRef};

fn abs_examples() -> &'static [&'static str] {
Expand Down Expand Up @@ -30,7 +30,7 @@ fn abs_examples() -> &'static [&'static str] {
]
}

fn bench_iri_parse(c: &mut Criterion) {
fn iri_parse(c: &mut Criterion) {
c.bench_function("Iri::parse", |b| {
b.iter(|| {
for iri in abs_examples().iter() {
Expand All @@ -40,7 +40,7 @@ fn bench_iri_parse(c: &mut Criterion) {
});
}

fn bench_iri_parse_relative(c: &mut Criterion) {
fn iri_parse_relative(c: &mut Criterion) {
c.bench_function("IriRef::parse", |b| {
b.iter(|| {
for iri in abs_examples().iter() {
Expand All @@ -50,7 +50,7 @@ fn bench_iri_parse_relative(c: &mut Criterion) {
});
}

fn bench_iri_resolve(c: &mut Criterion) {
fn iri_resolve(c: &mut Criterion) {
let examples = [
"g:h",
"g",
Expand Down Expand Up @@ -110,11 +110,6 @@ fn bench_iri_resolve(c: &mut Criterion) {
});
}

criterion_group!(
iri,
bench_iri_parse,
bench_iri_parse_relative,
bench_iri_resolve
);
criterion_group!(iri, iri_parse, iri_parse_relative, iri_resolve);

criterion_main!(iri);
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,6 @@ impl<'a, O: OutputBuffer> IriParser<'a, O> {
.truncate(last_slash_position + self.output_positions.authority_end)
}

#[inline]
fn read_url_codepoint_or_echar(&mut self, c: char) -> Result<(), IriParseError> {
if c == '%' {
self.read_echar()
Expand All @@ -1419,7 +1418,6 @@ impl<'a, O: OutputBuffer> IriParser<'a, O> {
}
}

#[inline]
fn read_url_query_codepoint_or_echar(&mut self, c: char) -> Result<(), IriParseError> {
if c == '%' {
self.read_echar()
Expand All @@ -1431,7 +1429,6 @@ impl<'a, O: OutputBuffer> IriParser<'a, O> {
}
}

#[inline]
fn read_echar(&mut self) -> Result<(), IriParseError> {
let c1 = self.input.next();
let c2 = self.input.next();
Expand All @@ -1451,7 +1448,6 @@ impl<'a, O: OutputBuffer> IriParser<'a, O> {
}
}

#[inline]
fn parse_error<T>(&self, kind: IriParseErrorKind) -> Result<T, IriParseError> {
Err(IriParseError { kind })
}
Expand Down