diff --git a/README.md b/README.md index 81bbc37..419938d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Create sync/async APIs with usable logic. Heavily inspired by [`genasync`](https://github.com/loganfsmyth/gensync) by [@loganfsmyth](https://github.com/loganfsmyth). +## Why & How + +Please refer to Anthony's blog post: [**Async, Sync, in Between**](https://antfu.me/posts/async-sync-in-between). + ## Usage ```bash @@ -47,25 +51,6 @@ const result = myFunction.sync('./some-file.js') const asyncResult = await myFunction.async('./some-file.js') ``` -## Why - -// TODO: - -## How it works - -// TODO: - -## Benchmark - -Run the following command to benchmark the performance of `quansync`: - -```bash -pnpm run build && pnpm run benchmark -``` - -Benchmark results indicate that each `yield` incurs an overhead of -approximately 150 ns, comparable to that of `await sync()`. (On Apple M1 Max) - ## Build-time Macro If you don't like the `function*` and `yield*` syntax, we also provide a build-time macro via [unplugin-quansync](https://github.com/unplugin/unplugin-quansync#usage) allowing you use quansync with async/await syntax, while still able to get the sync version out of that. @@ -99,6 +84,17 @@ const asyncResult = await myFunction.async('./some-file.js') For more details on usage, refer to [unplugin-quansync's docs](https://github.com/unplugin/unplugin-quansync#usage). +## Benchmark + +Run the following command to benchmark the performance of `quansync`: + +```bash +pnpm run build && pnpm run benchmark +``` + +Benchmark results indicate that each `yield` incurs an overhead of +approximately 150 ns, comparable to that of `await sync()`. (On Apple M1 Max) + ## Sponsors