Skip to content

Commit 6037bc0

Browse files
authored
Merge pull request #1229 from rylev/add-image-0.24.1-benchmark
Add `image-0.24.1` as a benchmark
2 parents 1342c31 + 367933a commit 6037bc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+35258
-0
lines changed

collector/benchmarks/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ They mostly consist of real-world crates.
1717

1818
- **cargo-0.60.0**: The Rust package manager. A large program, and an important
1919
one in the Rust ecosystem.
20+
- **image-0.24.1**: Basic image processing functions and methods for
21+
converting to and from various image formats. Used often in graphics
22+
programming.
2023
- **clap-rs**: A command line argument parser. A crate used by many Rust
2124
programs.
2225
- **cranelift-codegen**: The largest crate from a code generator. Used by
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "060a41c491a7b9cb7d1ebb3be5a100c8c3c73972"
4+
},
5+
"path_in_vcs": ""
6+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.jpg binary -delta
2+
*.png binary -delta
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report
3+
about: Reporting a bug
4+
labels: bug
5+
title: ''
6+
assignees: ''
7+
8+
---
9+
10+
This happens in ,...
11+
12+
## Expected
13+
14+
What behaviour should have happened
15+
16+
## Actual behaviour
17+
18+
What did happen
19+
20+
## Reproduction steps
21+
22+
Provide source code, a repository link, or steps
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Enabling something that is not yet possible
4+
labels: enhancement
5+
title: ''
6+
assignees: ''
7+
8+
---
9+
10+
<!-- Please fill out the relevant sections below, and delete all that do not apply: -->
11+
12+
I would like to be able ...
13+
14+
My specific use case for this functionality is ...
15+
16+
This is more generally applicable to ...
17+
18+
## Draft
19+
20+
<!-- Can you show a possible way to provide this functionality? Consider that a good
21+
draft drastically reduces mental overhead, gives context, and overall makes it
22+
much more likely to be implemented. The draft does not need to be an actual
23+
implementation but should provide a starting point for discussion. -->
24+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Question
3+
about: Unsure how to get something to work
4+
labels: question
5+
title: ''
6+
assignees: ''
7+
8+
---
9+
10+
How does one ... ?
11+
<!-- Describe the actual operation you are looking for, and think exists. If
12+
you know it doesn't then please use the feature request template instead -->
13+
14+
Overall, I'm trying to achieve ...
15+
<!-- Consider alternative solutions. But importantly, don't feel afraid to ask
16+
for ergonomic ways to achieve your means if you do not find any. -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
If you are a new contributor, consent to licensing by including this text:
3+
4+
I license past and future contributions under the dual MIT/Apache-2.0 license,
5+
allowing licensees to chose either at their option.
6+
7+
Thank you for contributing, you can delete this comment.
8+
-->
9+
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Rust CI
2+
on:
3+
push:
4+
branches: [ master, next ]
5+
pull_request:
6+
branches: [ master, next ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
rust: ["1.51.0", stable, beta, nightly]
13+
features: [ gif, jpeg, png, pnm, tga, dds, tiff, webp, hdr, farbfeld, '' ]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: ${{ matrix.rust }}
19+
override: true
20+
- name: build
21+
run: cargo build -v --no-default-features --features "$FEATURES"
22+
env:
23+
FEATURES: ${{ matrix.features }}
24+
- name: test
25+
run: >
26+
cargo test -v --no-default-features --features "$FEATURES" &&
27+
cargo doc -v --no-default-features --features "$FEATURES"
28+
env:
29+
FEATURES: ${{ matrix.features }}
30+
test_defaults:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: actions-rs/toolchain@v1
35+
with:
36+
toolchain: stable
37+
override: true
38+
- name: build
39+
run: cargo build -v --release
40+
- name: test
41+
run: cargo test -v --release
42+
test_avif:
43+
runs-on: ubuntu-20.04
44+
steps:
45+
- name: install-dependencies
46+
run: sudo apt update && sudo apt install nasm
47+
- uses: actions/checkout@v2
48+
- uses: actions-rs/toolchain@v1
49+
with:
50+
toolchain: stable
51+
override: true
52+
- name: build
53+
run: cargo build -v --no-default-features --features="avif"
54+
test_avif_decoding:
55+
runs-on: ubuntu-20.04
56+
steps:
57+
- name: install-dependencies
58+
run: sudo apt update && sudo apt install ninja-build meson nasm
59+
- uses: actions/checkout@v2
60+
- uses: actions-rs/toolchain@v1
61+
with:
62+
toolchain: stable
63+
override: true
64+
- name: build
65+
run: cargo build -v --no-default-features --features="avif-decoder"
66+
env:
67+
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always
68+
clippy:
69+
runs-on: ubuntu-20.04
70+
steps:
71+
- name: install-dependencies
72+
run: sudo apt update && sudo apt install ninja-build meson nasm
73+
- uses: actions/checkout@v2
74+
- uses: actions-rs/toolchain@v1
75+
with:
76+
toolchain: stable
77+
override: true
78+
components: clippy
79+
- uses: actions-rs/cargo@v1
80+
with:
81+
args: clippy --all-features -- -D warnings
82+
env:
83+
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always
84+
build_fuzz_afl:
85+
name: "Fuzz targets (afl)"
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v2
89+
- uses: actions-rs/toolchain@v1
90+
with:
91+
toolchain: nightly
92+
override: true
93+
- name: install-deps
94+
run: sudo apt-get -y install clang llvm
95+
- name: build
96+
run: |
97+
cargo install afl
98+
cd fuzz-afl
99+
cargo check --bin reproduce_webp
100+
cargo check --bin reproduce_pnm
101+
cargo afl check --bin fuzz_webp
102+
cargo afl check --bin fuzz_pnm
103+
env:
104+
RUSTFLAGS: "-Znew-llvm-pass-manager=no"
105+
build_fuzz_cargo-fuzz:
106+
name: "Fuzz targets (cargo-fuzz)"
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v2
110+
- uses: actions-rs/toolchain@v1
111+
with:
112+
toolchain: nightly
113+
override: true
114+
- name: build
115+
run: |
116+
cargo install cargo-fuzz
117+
cargo fuzz build
118+
- name: fuzz
119+
run: |
120+
for format in $(cargo fuzz list); do
121+
cargo fuzz run "$format" -- -runs=0;
122+
done
123+
public_private_dependencies:
124+
name: "Public private dependencies"
125+
runs-on: ubuntu-latest
126+
steps:
127+
- uses: actions/checkout@v2
128+
- uses: actions-rs/toolchain@v1
129+
with:
130+
toolchain: nightly
131+
override: true
132+
- name: build
133+
run: |
134+
mv ./Cargo.toml.public-private-dependencies ./Cargo.toml
135+
echo "#![deny(exported_private_dependencies)]" | cat - src/lib.rs > src/lib.rs.0
136+
mv src/lib.rs.0 src/lib.rs
137+
cargo check
138+
build_benchmarks:
139+
runs-on: ubuntu-latest
140+
steps:
141+
- uses: actions/checkout@v2
142+
- uses: actions-rs/toolchain@v1
143+
with:
144+
toolchain: nightly
145+
override: true
146+
- name: build
147+
run: cargo build -v --benches --features=benchmarks
148+
rustfmt:
149+
runs-on: ubuntu-latest
150+
steps:
151+
- uses: actions/checkout@v2
152+
- uses: actions-rs/toolchain@v1
153+
with:
154+
toolchain: stable
155+
override: true
156+
components: rustfmt
157+
- name: Run rustfmt check
158+
uses: actions-rs/cargo@v1
159+
with:
160+
command: fmt
161+
args: -- --check
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
*~
3+
*#
4+
*.o
5+
*.so
6+
*.swp
7+
*.dylib
8+
*.dSYM
9+
*.dll
10+
*.rlib
11+
*.dummy
12+
*.exe
13+
*-test
14+
/bin/main
15+
/bin/test-internal
16+
/bin/test-external
17+
/doc/
18+
/target
19+
/build/
20+
/.rust/
21+
rusti.sh
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/src/dynimage.rs b/src/dynimage.rs
2+
index d4f19ef..6743426 100644
3+
--- a/src/dynimage.rs
4+
+++ b/src/dynimage.rs
5+
@@ -647,6 +647,7 @@ pub fn load_from_memory(buffer: &[u8]) -> ImageResult<DynamicImage> {
6+
/// [`io::Reader`]: io/struct.Reader.html
7+
#[inline(always)]
8+
pub fn load_from_memory_with_format(buf: &[u8], format: ImageFormat) -> ImageResult<DynamicImage> {
9+
+ println!("testing");
10+
let b = io::Cursor::new(buf);
11+
free_functions::load(b, format)
12+
}

0 commit comments

Comments
 (0)