Skip to content

Instantly share code, notes, and snippets.

@jramapuram
Created August 6, 2018 19:10
Show Gist options
  • Save jramapuram/f3a69e5810f56347c470d10f54414c5e to your computer and use it in GitHub Desktop.
Save jramapuram/f3a69e5810f56347c470d10f54414c5e to your computer and use it in GitHub Desktop.
parallel_image_crop
```bash
(base) ➜ parallel_image_crop git:(master) cargo build --release
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading libc v0.2.43
Compiling version_check v0.1.4
Compiling nodrop v0.1.12
Compiling cfg-if v0.1.4
Compiling memoffset v0.2.1
Compiling scopeguard v0.3.3
Compiling num-traits v0.2.5
Compiling unicode-xid v0.1.0
Compiling num-integer v0.1.39
Compiling libc v0.2.43
Compiling rayon-core v1.4.1
Compiling rayon v1.0.2
Compiling num-iter v0.1.37
Compiling either v1.5.0
Compiling adler32 v1.0.3
Compiling byteorder v1.2.4
Compiling bitflags v1.0.3
Compiling lzw v0.10.0
Compiling color_quant v1.0.1
Compiling scoped_threadpool v0.1.9
Compiling arrayvec v0.4.7
Compiling crossbeam-utils v0.2.2
Compiling proc-macro2 v0.4.9
Compiling itertools v0.7.8
Compiling inflate v0.4.3
Compiling num_cpus v1.8.0
Compiling deflate v0.7.18
Compiling lazy_static v1.1.0
Compiling gif v0.10.0
Compiling crossbeam-epoch v0.3.1
Compiling crossbeam-deque v0.2.0
Compiling quote v0.6.5
Compiling syn v0.14.7
Compiling num-rational v0.1.42
Compiling png v0.12.0
Compiling jpeg-decoder v0.1.15
Compiling num-derive v0.2.2
Compiling image v0.19.0
Compiling parallel_image_crop v0.1.0 (file:///tmp/parallel_image_crop)
warning: unused import: `std::fs::File`
--> src/lib.rs:7:5
|
7 | use std::fs::File;
| ^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
warning: unused import: `OsStr`
--> src/lib.rs:9:22
|
9 | use std::ffi::{CStr, OsStr};
| ^^^^^
warning: unused import: `c_uchar`
--> src/lib.rs:12:28
|
12 | use libc::{size_t, c_char, c_uchar};
| ^^^^^^^
warning: unused imports: `ColorType`, `ImageBuffer`, `imageops`
--> src/lib.rs:13:27
|
13 | use image::{GenericImage, ImageBuffer, imageops, FilterType, ColorType, ImageDecoder};
| ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^
warning: unused import: `ImageDecoder`
--> src/lib.rs:13:73
|
13 | use image::{GenericImage, ImageBuffer, imageops, FilterType, ColorType, ImageDecoder};
| ^^^^^^^^^^^^
warning: method is never used: `into_vec`
--> src/lib.rs:70:5
|
70 | fn into_vec(self) -> Vec<u8> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
Finished release [optimized] target(s) in 46.87s
(base) ➜ parallel_image_crop git:(master) python benchmarks/test.py --batch-size=32 --num-trials=100
python crop average over 100 trials : 0.116404447555542 +/- 0.1595486246983642 sec
rust crop average over 100 trials : 0.09679011821746826 +/- 0.0062470562722498025 sec
(base) ➜ parallel_image_crop git:(master) convert assets/lena.png -resize 4000x4000 assets/lena.png
(base) ➜ parallel_image_crop git:(master) ✗ python benchmarks/test.py --batch-size=32 --num-trials=100
python crop average over 100 trials : 3.173974087238312 +/- 0.2067425334971192 sec
rust crop average over 100 trials : 4.159008667469025 +/- 0.20634427332646715 sec
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment