Skip to content

Commit bdcc7d4

Browse files
committed
added perf
1 parent 138f0e5 commit bdcc7d4

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
decode: require("./decode"),
3-
encode: require("./encode")
2+
decode: require("./decode.js"),
3+
encode: require("./encode.js")
44
};

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
"version": "0.0.1",
44
"description": "Fast Run Length Encoder and Decoder",
55
"main": "index.js",
6+
"files": [
7+
"index.js",
8+
"encode.js",
9+
"decode.js"
10+
],
611
"scripts": {
712
"format": "npx prettier --arrow-parens=avoid --trailing-comma=none --write *.js",
813
"test": "node test"

test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const test = require("flug");
22
const decode = require("./decode");
3-
const encode = require("./encode");
3+
const encode = require("./encode.js");
44

55
const decoded = [3, 3, 3, 3, 3, 8, 0, 0];
66
const encoded = [5, 3, 1, 8, 2, 0];
@@ -30,3 +30,10 @@ test("encoded with chunking", ({ eq }) => {
3030
const actual = encode(decoded, { chunk: true });
3131
eq(actual, chunked);
3232
});
33+
34+
const len = 10_000_000;
35+
const nums = new Uint8Array(len);
36+
for (let i = 0; i <= len; i++) nums[i] = Math.round(Math.random() * 3);
37+
test("perf", ({ eq }) => {
38+
encode(nums);
39+
});

0 commit comments

Comments
 (0)