Skip to content

Commit

Permalink
fix: avif encoding is too slow
Browse files Browse the repository at this point in the history
  • Loading branch information
yisibl committed Oct 25, 2021
1 parent ae55276 commit 407d1d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ function createCanvas(width, height, flag) {
this,
type,
JSON.stringify({
quality: 92,
quality: 80,
alphaQuality: 92,
threads: 0,
speed: 1,
speed: 4,
...(qualityOrConfig || {}),
}),
)
Expand All @@ -244,10 +244,10 @@ function createCanvas(width, height, flag) {
this,
type,
JSON.stringify({
quality: 92,
quality: 80,
alphaQuality: 92,
threads: 0,
speed: 1,
speed: 4,
...(qualityOrConfig || {}),
}),
)
Expand All @@ -261,10 +261,10 @@ function createCanvas(width, height, flag) {
this,
type,
JSON.stringify({
quality: 92,
quality: 80,
alphaQuality: 92,
threads: 0,
speed: 1,
speed: 4,
...(qualityOrConfig || {}),
}),
)
Expand All @@ -278,10 +278,10 @@ function createCanvas(width, height, flag) {
this,
type,
JSON.stringify({
quality: 92,
quality: 80,
alphaQuality: 92,
threads: 0,
speed: 1,
speed: 4,
...(qualityOrConfig || {}),
}),
)
Expand All @@ -295,10 +295,10 @@ function createCanvas(width, height, flag) {
this,
type,
JSON.stringify({
quality: 92,
quality: 80,
alphaQuality: 92,
threads: 0,
speed: 1,
speed: 4,
...(qualityOrConfig || {}),
}),
)
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const MIME_PNG: &str = "image/png";
const MIME_JPEG: &str = "image/jpeg";
const MIME_AVIF: &str = "image/avif";

const DEFAULT_IMAGE_QUALITY: u8 = 92;
const DEFAULT_IMAGE_QUALITY: u8 = 80;

#[module_exports]
fn init(mut exports: JsObject, env: Env) -> Result<()> {
Expand Down

1 comment on commit 407d1d1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 407d1d1 Previous: ae55276 Ratio
Draw house#skia-canvas 30 ops/sec (±1.27%) 22 ops/sec (±0.4%) 0.73
Draw house#node-canvas 24 ops/sec (±0.6%) 18 ops/sec (±0.37%) 0.75
Draw house#@napi-rs/skia 27 ops/sec (±1.03%) 20 ops/sec (±0.93%) 0.74
Draw gradient#skia-canvas 28 ops/sec (±0.92%) 21 ops/sec (±0.2%) 0.75
Draw gradient#node-canvas 23 ops/sec (±1.11%) 17 ops/sec (±0.13%) 0.74
Draw gradient#@napi-rs/skia 26 ops/sec (±1.03%) 19 ops/sec (±0.71%) 0.73

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.