Skip to content

Commit

Permalink
chore: fixed benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
cereallarceny committed Sep 12, 2024
1 parent 0f74545 commit 9f5f58e
Show file tree
Hide file tree
Showing 21 changed files with 31 additions and 40 deletions.
12 changes: 1 addition & 11 deletions apps/web/app/benchmark/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export default function File(): JSX.Element {
const url = URL.createObjectURL(blob);

setSrc(url);

// Create the link
const link = document.getElementById('download') as HTMLAnchorElement;
link.download = 'qr.gif';
link.href = url;
}, [text]);

const handleSubmit = async (event: Event): Promise<void> => {
Expand Down Expand Up @@ -66,12 +61,7 @@ export default function File(): JSX.Element {
</button>
<br />
{src && (
<>
<Image alt="QR code" id="image" src={src} width={200} height={200} />
<a id="download" type="button">
Download
</a>
</>
<Image alt="QR code" id="image" src={src} width={200} height={200} />
)}

<hr style={{ marginTop: 20, marginBottom: 20 }} />
Expand Down
12 changes: 6 additions & 6 deletions packages/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (writer) with 100 char string | 6 | 166432620.7999996 | ±9.14% | 10 |
| Flipbook (writer) with 100 char string | 20 | 48473837 | ±17.67% | 11 |

#### For 1,000 char string

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (writer) with 1000 char string | 1 | 597150516.7000005 | ±0.99% | 10 |
| Flipbook (writer) with 1000 char string | 11 | 85619445.89999984 | ±7.02% | 10 |

#### For 10,000 char string

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (writer) with 10000 char string | 0 | 4966372033.2 | ±0.25% | 10 |
| Flipbook (writer) with 10000 char string | 2 | 338170971.09999996 | ±3.02% | 10 |

### Reader

#### For 100 char string

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (reader) with 100 char string | 10 | 95136383.39999998 | ±7.87% | 10 |
| Flipbook (reader) with 100 char string | 15 | 65113337.49999994 | ±14.12% | 10 |

#### For 1,000 char string

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (reader) with 1000 char string | 3 | 268014191.79999974 | ±2.51% | 10 |
| Flipbook (reader) with 1000 char string | 6 | 145288429.1999999 | ±5.76% | 10 |

#### For 10,000 char string

| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
| --- | --- | --- | --- | --- |
| Flipbook (reader) with 10000 char string | 0 | 1849772500.2000005 | ±0.71% | 10 |
| Flipbook (reader) with 10000 char string | 1 | 709327133.4000001 | ±1.58% | 10 |
Binary file removed packages/e2e/results/assets/bench-hundred-0.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-1.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-10.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-2.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-3.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-4.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-5.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-6.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-7.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-8.gif
Binary file not shown.
Binary file removed packages/e2e/results/assets/bench-hundred-9.gif
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/e2e/results/reader-bench-10k.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (reader) with 10000 char string",
"ops/sec": "0",
"Average Time (ns)": 1849772500.2000005,
"Margin": "±0.71%",
"ops/sec": "1",
"Average Time (ns)": 709327133.4000001,
"Margin": "±1.58%",
"Samples": 10
}
6 changes: 3 additions & 3 deletions packages/e2e/results/reader-bench-1k.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (reader) with 1000 char string",
"ops/sec": "3",
"Average Time (ns)": 268014191.79999974,
"Margin": "±2.51%",
"ops/sec": "6",
"Average Time (ns)": 145288429.1999999,
"Margin": "±5.76%",
"Samples": 10
}
6 changes: 3 additions & 3 deletions packages/e2e/results/reader-bench-hundred.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (reader) with 100 char string",
"ops/sec": "10",
"Average Time (ns)": 95136383.39999998,
"Margin": "±7.87%",
"ops/sec": "15",
"Average Time (ns)": 65113337.49999994,
"Margin": "±14.12%",
"Samples": 10
}
6 changes: 3 additions & 3 deletions packages/e2e/results/writer-bench-10k.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (writer) with 10000 char string",
"ops/sec": "0",
"Average Time (ns)": 4966372033.2,
"Margin": "±0.25%",
"ops/sec": "2",
"Average Time (ns)": 338170971.09999996,
"Margin": "±3.02%",
"Samples": 10
}
6 changes: 3 additions & 3 deletions packages/e2e/results/writer-bench-1k.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (writer) with 1000 char string",
"ops/sec": "1",
"Average Time (ns)": 597150516.7000005,
"Margin": "±0.99%",
"ops/sec": "11",
"Average Time (ns)": 85619445.89999984,
"Margin": "±7.02%",
"Samples": 10
}
8 changes: 4 additions & 4 deletions packages/e2e/results/writer-bench-hundred.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Task Name": "Flipbook (writer) with 100 char string",
"ops/sec": "13",
"Average Time (ns)": 73629129.2,
"Margin": "±19.15%",
"Samples": 10
"ops/sec": "20",
"Average Time (ns)": 48473837,
"Margin": "±17.67%",
"Samples": 11
}
7 changes: 4 additions & 3 deletions packages/typescript-config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"module": "ESNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"moduleResolution": "Node",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2022",
"target": "ESNext",
"paths": {
"@flipbookqr/*": ["../../packages/*/src"]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/writer/src/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,6 @@ export class Writer {
this.log.debug('Final QR buffer', qr);

// Return the GIF URL
return new Blob([qr]);
return new Blob([qr], { type: 'image/gif' });
}
}

0 comments on commit 9f5f58e

Please sign in to comment.