Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "jay-peg", | ||
"description": "Performant JPEG decoder", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -100,12 +100,19 @@ # jay-peg | ||
Performance is a key focus of `jay-peg``. In a benchmark test using a 2448×3264, 2.2MB JPEG image, the decoding speed was measured as follows: | ||
Performance is a key focus of `jay-peg`. 4 sizes of images were benchmarked: | ||
- `small`: 300 × 150, 8KB image | ||
- `medium`: 800 × 600, 70KB image | ||
- `large`: 1920 × 1080, 332KB image | ||
- `huge`: 2448×3264, 2.2MB image | ||
For each of these, the decoding speed was measured as follows: | ||
``` | ||
Benchmarked: small: x 11,597 ops/sec ±0.60% (95 runs sampled) | ||
Benchmarked: medium: x 11,219 ops/sec ±0.20% (98 runs sampled) | ||
Benchmarked: large: x 7,744 ops/sec ±0.27% (100 runs sampled) | ||
Benchmarked: huge: x 2,019 ops/sec ±0.36% (96 runs sampled) | ||
Benchmarked: small: x 13,393 ops/sec ±4.77% (96 runs sampled) | ||
Benchmarked: medium: x 12,894 ops/sec ±0.10% (99 runs sampled) | ||
Benchmarked: large: x 9,241 ops/sec ±0.25% (99 runs sampled) | ||
Benchmarked: huge: x 2,672 ops/sec ±0.12% (100 runs sampled) | ||
``` | ||
It's worth noting that the performance is significantly improved on smaller and simpler images. | ||
_Measures were taken in an MacBook Air 2024, Apple M3 w/16GB of RAM._ | ||
@@ -112,0 +119,0 @@ ## License |
@@ -14,17 +14,7 @@ export const readUInt8 = (array, offset) => { | ||
export const readUInt32BE = (array, offset) => { | ||
return ( | ||
(array[offset] << 24) | | ||
(array[offset + 1] << 16) | | ||
(array[offset + 2] << 8) | | ||
array[offset + 3] | ||
); | ||
return readInt32BE(array, offset) >>> 0; | ||
}; | ||
export const readUInt32LE = (array, offset) => { | ||
return ( | ||
array[offset] | | ||
(array[offset + 1] << 8) | | ||
(array[offset + 2] << 16) | | ||
(array[offset + 3] << 24) | ||
); | ||
return readInt32LE(array, offset) >>> 0; | ||
}; | ||
@@ -59,7 +49,17 @@ | ||
export const readInt32BE = (array, offset) => { | ||
return readUInt32BE(array, offset) | 0; | ||
return ( | ||
(array[offset] << 24) | | ||
(array[offset + 1] << 16) | | ||
(array[offset + 2] << 8) | | ||
array[offset + 3] | ||
); | ||
}; | ||
export const readInt32LE = (array, offset) => { | ||
return readUInt32LE(array, offset) | 0; | ||
return ( | ||
array[offset] | | ||
(array[offset + 1] << 8) | | ||
(array[offset + 2] << 16) | | ||
(array[offset + 3] << 24) | ||
); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
66245
121