diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
new file mode 100644
index 0000000..95ddb92
--- /dev/null
+++ b/.github/workflows/benchmark.yml
@@ -0,0 +1,40 @@
+name: Benchmark
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: Use Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: '20.x'
+ cache: 'pnpm'
+
+ - run: pnpm install
+ - run: pnpm dev
+
+ - name: Wait for localhost
+ run: |
+ timeout 300 bash -c 'until curl -s -o /dev/null http://localhost:3000; do sleep 5; done'
+
+ - run: pnpm benchmark
+
+ - name: Upload benchmark results
+ uses: actions/upload-artifact@v4
+ with:
+ name: benchmark-results
+ path: packages/e2e/results
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..561e780
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,24 @@
+name: Build, Lint, and Test
+
+on: [push]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: pnpm/action-setup@v2
+ with:
+ version: 8
+
+ - name: Use Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: '20.x'
+ cache: 'pnpm'
+
+ - run: pnpm install
+ - run: pnpm run build
+ - run: pnpm run lint
+ - run: pnpm test
diff --git a/README.md b/README.md
index c1fbf9b..73c2c04 100644
--- a/README.md
+++ b/README.md
@@ -1,47 +1 @@
-
-
-
-
Flipbook
-
-
-[![Build Status](https://travis-ci.org/cereallarceny/flipbook.svg?branch=main)](https://travis-ci.org/cereallrceny/flipbook)
-[![Coverage Status](https://coveralls.io/repos/github/cereallarceny/flipbook/badge.svg?branch=main)](https://coveralls.io/github/cereallarceny/flipbook?branch=main)
-
-## Getting Started
-
-Flipbook is a series of libraries that you can use in any web, mobile, or desktop application that enable the writing and reading of QR codes that contain larger payloads than traditional QR codes. This is done by creating a series of QR codes that are stitched together into an animated GIF, called a "Flipbook". This Flipbook can then be scanned by the reader library and subsequently reassembled into the original payload.
-
-![Flipbook Example](./docs/flipbook-qr.gif)
-
-**[Download Reader](https://flipbook.codes)**
-
-### Why?
-
-The ubiquity of QR codes in daily life has made them a popular tool for sharing information. But the medium is inherently limited to payloads of small sizes. While larger payloads can be supported (to a point), the resulting QR code becomes too difficult to scan reliably.
-
-### Are there any size limitations?
-
-In theory, no. It would simply be a matter of how long it takes for the writer to encode the payload into a Flipbook, and how long it takes for the reader to decode the Flipbook back into the original payload.
-
-### What can a Flipbook contain?
-
-Anything! Books... movies... music... software... anything that can be represented as a series of bytes can be encoded into a Flipbook.
-
-## Libraries
-
-- Writer (Typescript): [Documentation](./packages/writer) | [NPM Package](https://www.npmjs.com/package/@flipbook/writer)
-- Reader (Typescript): [Documentation](./packages/reader) | [NPM Package](https://www.npmjs.com/package/@flipbook/reader)
-- Writer (Rust): *Coming soon...*
-- Reader (Rust): *Coming soon...*
-
-### Want to write a Flipbook binding?
-
-If you want to write a Flipbook binding for a language that isn't listed here, feel free to open an issue or a pull request. We'd love to see Flipbook supported in as many languages as possible!
-
-## Contributing
-
-If you'd like to contribute to Flipbook, please read our [contributing guide](./CONTRIBUTING.md) to learn how to get started.
-
-## License
-
-Flipbook is licensed under the [MIT License](./LICENSE). Go nuts!
+# Benchmarks
\ No newline at end of file
diff --git a/packages/e2e/README.md b/packages/e2e/README.md
new file mode 100644
index 0000000..283cae0
--- /dev/null
+++ b/packages/e2e/README.md
@@ -0,0 +1,11 @@
+
+## Benchmarks
+
+### Writer
+
+#### For 100 char string
+
+| Task Name | ops/sec | Average Time (ns) | Margin | Samples |
+| --- | --- | --- | --- | --- |
+| Generate QrCode Gif from 100 char string | 6 | 143733162.69999996 | ±6.02% | 10 |
+
diff --git a/packages/e2e/docs/README.md b/packages/e2e/docs/README.md
deleted file mode 100644
index f435541..0000000
--- a/packages/e2e/docs/README.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# Turborepo starter
-
-This is an official starter Turborepo.
-
-## Using this example
-
-Run the following command:
-
-```sh
-npx create-turbo@latest
-```
-
-## What's inside?
-
-This Turborepo includes the following packages/apps:
-
-### Apps and Packages
-
-- `docs`: a [Next.js](https://nextjs.org/) app
-- `web`: another [Next.js](https://nextjs.org/) app
-- `ui`: a stub React component library shared by both `web` and `docs` applications
-- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
-- `tsconfig`: `tsconfig.json`s used throughout the monorepo
-
-Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
-
-### Utilities
-
-This Turborepo has some additional tools already setup for you:
-
-- [TypeScript](https://www.typescriptlang.org/) for static type checking
-- [ESLint](https://eslint.org/) for code linting
-- [Prettier](https://prettier.io) for code formatting
-
-### Build
-
-To build all apps and packages, run the following command:
-
-```
-cd my-turborepo
-pnpm build
-```
-
-### Develop
-
-To develop all apps and packages, run the following command:
-
-```
-cd my-turborepo
-pnpm dev
-```
-
-### Remote Caching
-
-Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
-
-By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
-
-```
-cd my-turborepo
-npx turbo login
-```
-
-This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
-
-Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
-
-```
-npx turbo link
-```
-
-## Useful Links
-
-Learn more about the power of Turborepo:
-
-- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
-- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
-- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
-- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
-- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
-- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
-
-#include "docs/benchmarks.md"
diff --git a/packages/e2e/markdown.json b/packages/e2e/markdown.json
deleted file mode 100644
index 091a4f6..0000000
--- a/packages/e2e/markdown.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "build": "../../README.md",
- "files": ["./docs/README.md"]
-}
diff --git a/packages/e2e/package.json b/packages/e2e/package.json
index 555711a..60ba4e6 100644
--- a/packages/e2e/package.json
+++ b/packages/e2e/package.json
@@ -6,13 +6,12 @@
"scripts": {
"benchmark:dev": "playwright test --headed --ui",
"benchmark": "playwright test && pnpm generate:readme",
- "generate:readme": "node ./scripts/add-benchmarks-to-markdown.js && markdown-include ./markdown.json",
+ "generate:readme": "node ./scripts/add-benchmarks-to-markdown.js",
"postinstall": "pnpm playwright install"
},
"dependencies": {},
"devDependencies": {
"tinybench": "^2.6.0",
- "@playwright/test": "^1.41.1",
- "markdown-include": "^0.4.3"
+ "@playwright/test": "^1.41.1"
}
}
diff --git a/packages/e2e/results/reader-bench-hundred.json b/packages/e2e/results/reader-bench-hundred.json
new file mode 100644
index 0000000..eda655c
--- /dev/null
+++ b/packages/e2e/results/reader-bench-hundred.json
@@ -0,0 +1,7 @@
+{
+ "Task Name": "Generate QrCode Gif from 100 char string",
+ "ops/sec": "2",
+ "Average Time (ns)": 415900570.7,
+ "Margin": "±11.49%",
+ "Samples": 10
+}
diff --git a/packages/e2e/results/writer-bench-hundred.json b/packages/e2e/results/writer-bench-hundred.json
new file mode 100644
index 0000000..f3d4c34
--- /dev/null
+++ b/packages/e2e/results/writer-bench-hundred.json
@@ -0,0 +1,7 @@
+{
+ "Task Name": "Generate QrCode Gif from 100 char string",
+ "ops/sec": "6",
+ "Average Time (ns)": 143733162.69999996,
+ "Margin": "±6.02%",
+ "Samples": 10
+}
diff --git a/packages/e2e/scripts/add-benchmarks-to-markdown.js b/packages/e2e/scripts/add-benchmarks-to-markdown.js
index 004593e..4b40ff4 100644
--- a/packages/e2e/scripts/add-benchmarks-to-markdown.js
+++ b/packages/e2e/scripts/add-benchmarks-to-markdown.js
@@ -36,10 +36,10 @@ function generateMarkdownTable(data) {
};
// output directory
- const outDir = path.resolve(__dirname, '..', 'build');
+ const outDir = path.resolve(__dirname, '..', 'results');
// docs directory
- const docsDir = path.resolve(__dirname, '..', 'docs');
+ const docsDir = path.resolve(__dirname, '..');
// read files
const writerHundred = await fs.readFile(
@@ -103,7 +103,7 @@ function generateMarkdownTable(data) {
const markdown = `\n## Benchmarks\n\n### Writer\n\n#### For 100 char string\n\n${writerHundredTable}\n\n#### For 1,000 char string\n\n${writerThousandTable}\n\n#### For 10,000 char string\n\n${writerTenThousandTable}\n\n#### For 100,000 char string\n\n${writerHundredThousandTable}\n\n### Reader\n\n#### For 100 char string\n\n${readerHundredTable}\n\n#### For 1,000 char string\n\n${readerThousandTable}\n\n#### For 10,000 char string\n\n${readerTenThousandTable}\n\n#### For 100,000 char string\n\n${readerHundredThousandTable}`;
// save markdown
- await fs.writeFile(`${docsDir}/benchmarks.md`, markdown, 'utf-8');
+ await fs.writeFile(`${docsDir}/README.md`, markdown, 'utf-8');
} catch (err) {
console.log('Error saving benchmark:', err);
}
diff --git a/packages/e2e/src/helpers.ts b/packages/e2e/src/helpers.ts
index 3433498..2c2b3d4 100644
--- a/packages/e2e/src/helpers.ts
+++ b/packages/e2e/src/helpers.ts
@@ -25,7 +25,7 @@ type TBenchOutput = ({
export const saveBenchMark = async (fileName: string, value: TBenchOutput) => {
try {
- const outDir = path.resolve(__dirname, '..', 'build');
+ const outDir = path.resolve(__dirname, '..', 'results');
const jsonData = {
'Task Name': value[0]?.['Task Name'] || null,